lua-users home
lua-l archive

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



Nodir Temirhodzhaev wrote:

 Is it correct store pointer to userdata outside lua tables? GC may change it's location?

Yes, you can store a C pointer to your userdata and use it however you like.

The GC is mark-sweep, so it will never copy or move your data. Your userdata will stay at the same memory location until it is destroyed. The __gc event will let you know when it is destroyed.

- Peter Shook