lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The Four Laws of a userdata:

1. The closest a full userdata ever gets to your C code is the Lua stack.
2. You can create a new userdata on the stack.
3. You can receive an old userdata on the stack.
4. There is no other way to return a userdata to Lua.

You can check the registry type of a userdata on the stack, get its
block address, modify its contents, push the block address as a light
userdata — but you can't transform that light userdata back into a
full one.  Once it's off the stack, it is gone.

Right?