lua-users home
lua-l archive

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



lua_State *L = lua_open();
luaL_openlibs(L);
luaL_dofile(L, "../Scripts/initialize.lua");
//luaL_loadfile(L, "../Scripts/initialize.lua");
//lua_pcall(L,0,0,0);
lua_getglobal(L, "Configuration");
lua_pushstring(L, "width");
lua_gettable(L, -2);
int w = (int) lua_tonumber(L, -1);
lua_pop(L, 1);
lua_pushstring(L, "height");
lua_gettable(L, -2);
int h = (int) lua_tonumber(L, -1);
lua_pop(L, 1);
lua_getglobal(L, "RenderEngine");
lua_pushstring(L, "Initialize");
lua_gettable(L, -1);


Shouldn't this be lua_gettable(L, -2)?

lua_insert(L, 1);
lua_pcall(L, 0, 1, 0);
int bOK = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
lua_close(L);