From 97295e18c48a09fac4ebc62087aa59e44a87884a Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Mon, 8 Jul 2013 23:00:57 +0000 Subject: [PATCH] sdl: applied patch to use system lua on non-win platforms (thanks Joe Nahmias!) --- trunk/src/lua-engine.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/trunk/src/lua-engine.cpp b/trunk/src/lua-engine.cpp index 09fd9d78..cd621e03 100644 --- a/trunk/src/lua-engine.cpp +++ b/trunk/src/lua-engine.cpp @@ -85,8 +85,8 @@ extern "C" #include #include #include -#include #ifdef WIN32 +#include int iuplua_open(lua_State * L); int iupcontrolslua_open(lua_State * L); int luaopen_winapi(lua_State * L); @@ -1189,6 +1189,7 @@ void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& save if (lua_isfunction(L, -1)) { +#ifdef WIN32 // since the scriptdata can be very expensive to load // (e.g. the registered save function returned some huge tables) // check the number of parameters the registered load function expects @@ -1200,6 +1201,13 @@ void CallRegisteredLuaLoadFunctions(int savestateNumber, const LuaSaveData& save lua_pushinteger(L, savestateNumber); saveData.LoadRecord(L, LUA_DATARECORDKEY, numParamsExpected); +#else + int prevGarbage = lua_gc(L, LUA_GCCOUNT, 0); + + lua_pushinteger(L, savestateNumber); + saveData.LoadRecord(L, LUA_DATARECORDKEY, (unsigned int) -1); +#endif + int n = lua_gettop(L) - 1; int ret = lua_pcall(L, n, 0, 0);