lua-users home
lua-l archive

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


How does the "__getitem" and "__setitem" magic stuff in SWIG_Lua_class_get and SWIG_Lua_class_set work?

It delegates to a function in the metatable called __getitem and __setitem, but I'm not sure how to set these up, or get a reference to the metatable from lua to poke my function in there.

I think the __getitem hook would be useful to delegate unknown attributes to a lua peer object (stored in the environment of the userdata).

   -Don