function onLoad( )
output ( "Loaded file one!" ) -- custom function
end
-- More code
function onLoad( )
output ( "Loaded file two!" ) -- custom function
end
void LoadLUA() {
lua_State* L;
L = lua_open();
luaL_openlibs(L);
lua_register(L,"output","Print");
// Load the first file
luaL_dofile(L,"File1.lua");
// Load the second file
luaL_dofile(L,"File2.lua");
// Now, call the callback
lua_getglobal(L,"onLoad");
if(!lua_isfunction(L,-1)) return;
lua_call(L,0,0);
}