Basically, I'm trying to register a callback into a Lua state like this:
class MyClass
{
public:
int myLuaFunction(lua_State* L)
{
//do something
}
};
I want to be able to call MyClass::myLuaFunction of a given instance (which could register itself).
I've spent a couple hours trying to do tricks with templates and lambdas in an attempt to get it to work, but I haven't got anything successful (mainly the fact that I couldn't pass a lamba function that uses parent scope variables to Lua's API).
Without having to download any other libraries (just Lua's standard interpreter implementation), how could I do this?