lua-users home
lua-l archive

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

At 1241786916 time_t, Duncan Cross wrote:
> There is probably a better way than using luaL_ref and luaL_unref to
> associate a callback with your myninja object. I assume myninja is a
> full userdata in the Lua universe - if so, I would give myninja a
> unique "environment" table (lua_setfenv and lua_getfenv work on full
> userdata, and are only available from the API), and have the weapon
> callback be a normal key-value entry in that. If not, what is it, a
> light userdata?

Yeah, everything is "full" userdata.
Using setfenv() sounds like a nice idea.

Thanks a lot.

Julien Danjou
// ᐰ <>
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// My root password is

Attachment: signature.asc
Description: Digital signature