API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

ILUAEX_NEWUSERDATA()

Brew Release
Brew MP 1.0.2
See Also
ILuaEx_PushLightUserData(), ILuaEx_ToUserData(), ILua_NewMetaTable(), ILua_GetMetaTable(), ILua_SetMetaTable()
Description
Allocates a new block of memory of the given size and pushes onto the stack a new full userdata that encapsulates this block.
Userdata represent C values in Lua. A full userdata represents a block of memory. It is an object (like a table): you must create it, it can have its own metatable, and you can detect when it is being collected. A full userdata is only equal to itself (under raw equality).
When Lua collects a full userdata with a gc metamethod, Lua calls the metamethod and marks the userdata as finalized. When this userdata is collected again then Lua frees its corresponding memory.
Params
pif
[]:
a pointer to the ILuaEx object
nNumBytes
[]:
number of bytes to allocate for the userdata
Interface
Prototype
  •    void *ILuaEx_NewUserData(ILuaEx *pif, int nNumBytes)
    
Return
  • A pointer to the allocated block.