lua-users home
lua-l archive

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


Matthew Armstrong wrote:
> I don't see lua_push/is/get functions for table or function
> references.  The only way I can think of storing them is with the
> registry, but that seems like a lot of work.  Is there another way
> I'm missing?

There is a lua_istable and lua_isfunction. Lua tables are in fact hash
maps, and Lua function are in fact closures. There is no such kind of
obejcts in C, so it cannot be extracted to Lua. If you want to keep a
reference to them you have to put them in a table, like the registry,
the globals, a metatable or an environment table of one of your
userdata.