pub unsafe extern "C" fn newuserdata(
state: lua_State,
size: usize,
) -> *mut c_void
Expand description
This function allocates a new block of memory with the given size, pushes onto the stack a new full userdata with the block address, and returns this address.
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.