-- XXX configuration file.
RenderEngine = {
};
Configuration = {
width = 1280,
height = 1024,
fullscreen = 1
};
-- Called before render engine is initialized
function RenderEngine:Initialize()
return 1;
end
-- Called after render engine is Shutdown
function RenderEngine:ShutDown()
return 1;
end
And my code for call Initialize looks like this.
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);
lua_insert(L, 1);
lua_pcall(L, 0, 1, 0);
int bOK = (int)lua_tointeger(L, -1);
lua_pop(L, 1);
lua_close(L);
Can you see what I'm doing wrong ?
Thanks,
Anders.