Original Post
Hi, before I ask my question, here is some code: Okay, all I do here is to create a class, register it with the CD and then calling the function 2times in Lua and then normally in C++. Okay, I would say, the output should look like: val = 0 val = 1 val = 2 val = 3 But, it doesn't :) When I start this under VS.NEt 2003 I get: value 0 value 1 value 0 value 3 Why? Greetings
class CTEST {
public:
void TEST(int test) {
printf("value %i\n", val);
val = test;
}
int val;
};
CTEST test;
test.val = 0;
lua_pushstring(m_Luastate, "TEST");
lua_pushdirectclosure(m_Luastate, test, CTEST::TEST, 0);
lua_settable(m_Luastate, LUA_GLOBALSINDEX);
lua_dostring(m_Luastate, "TEST(1)");
lua_dostring(m_Luastate, "TEST(2)");
test.TEST(3);
test.TEST(4);