Original Post
Hi I want to (pre)load lua script and execute it later not a the load time. Here's what I'm doing : Does anyone have a solution ?
Lua = luaL_newstate();
luaL_openlibs(Lua);
luaL_loadfile(Lua, "data/script.lua");
lua_pcall(Lua, 0, 0, 0); // I have to call this function else
// the script isn't working
lua_getglobal(Lua, "Init");
if (lua_isfunction(Lua, -1))
{
lua_call(Lua, 0, 0);
}