lua-users home
lua-l archive

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


From: Gavin Kistner
> The reason I'm asking is I want a way to associate some 
> userdata objects
> with a function so that the function always has access to them.

Er...duh. I forgot that Lua functions are first-class objects, but that
objects in Lua are not necessarily tables. Hence, no way to assign
custom properties to them.

Does anyone have any suggestions on how to pre-allocate a few userdata
objects and associate them with a specific function, so that when that
function is called (from different 'scopes' as the self using Lua's OOP
syntax sugar) you can access them?