I'm using lua 5.2.2 with luabind 0.9.
I'd like to be able to add additional class-methods through lua for any classes that I've bound in c++, but I'm unsure how to do it.
The problem is that luabind uses a function as the __index-metamethod for any bound classes instead of a table, so I don't see a way to access the class-methods at all.
e.g., I'm binding my classes like this:
What I essentially want to do is to add a lua-function to the list of methods for this class, and be able to overwrite existing ones:Code:luabind::module(lua) [ luabind::class_<testClass>("TestClass") .def(luabind::constructor<>()) .def("TestFunc",&TestFunc) ];
Any help would be appreciated.Code:local t = tableOfClassMethods local r = t.TestFunc -- Reference to the c++-function we've bound t.SomeFunction = function(o) end -- New function for all objects of this class t.TestFunc = function(o) end -- Should overwrite the c++-function of the same name




Reply With Quote
