lua-users home
lua-l archive

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


Hello!

I want to call a lua member function from C, and I can not get it to work. This is how I do it now.

 lua_getglobal(L, "IWindow");
 lua_getfield(L, -1, "new");
 lua_pushnumber(L, 100);
 lua_pushstring(L, "foo");
 if (lua_pcall(L, 2, 1, 0) != 0)
 {
   printf("\n%s", lua_tostring(L, -1));
 }

I have a class in lua called IWindow, and it has a member function called new. So I want to do IWindow:new(100,"foo") basicly. But for some strange reason, when I arrive in my function, the first parameter is "foo" and the second parameter is nil. So where has the number (100) gone? I'm sure the error is just something small, but I do not understand what it is...

- Lyte

_________________________________________________________________
Messenger direkt i din 3-mobil! http://msn.microsoft.se/adstat/msnstats/sweden/redirect.asp?msnid=1460