lua-users home
lua-l archive

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


I am curious how you make the userdata private to the Lua object?

I put the word private in quotes :-) It is actually under a __data index in the table. I'm one of those guys that think that public vs. private discussions are irrelevant.

... I was worried that scripting could 'disassociate' my C object by directly modifying the table.

It can.  :-)  Just stop worrying about it...!

Also, how do you handle GC? I thought light userdata and Lua tables can not have __gc methods.

If gc is needed then I use a userdata in the __data field and give that a __gc metamethod.

--
Wim