I am currently trying to learn how to bridge Lua with C++ and write scripts. The problem that I have is that most of the tutorial or documentation is somewhat simplified. Or maybe I have the wrong approach, which is why I am asking here now.
I am trying to initialize the meta table and more specifically. Trying to add functions. Like so;
luaL_Reg rmFuncs[] =
{
{ "rotate", RotateBlocks },
{ NULL, NULL }
};
But to add RotateBlocks is a bit tricky. All examples that I've found is done in main and not in classes. RotateBlocks is actually Application::RotateBlocks.
So the only way for me to make it work is like this:
static int RotateBlocks(lua_State* L);
Is this the only way? Because this causes a lot of problems. As it is static, I cant actually rotate the objects that I want inside the function. Because all my membervalues complain on the function being static.
So how do I actually do anything useful inside my functions and not just printf a random sentence as in all the tutorials or documentation?
Aucun commentaire:
Enregistrer un commentaire