From 2a1ee15a54b8e715924c984ece71394c7cc1a0f7 Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 26 Apr 2012 00:46:49 +0000 Subject: [PATCH] - applied patch for lua 5.2 --- source/shared_lib/sources/lua/lua_script.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/shared_lib/sources/lua/lua_script.cpp b/source/shared_lib/sources/lua/lua_script.cpp index 2462ca903..c723f907b 100644 --- a/source/shared_lib/sources/lua/lua_script.cpp +++ b/source/shared_lib/sources/lua/lua_script.cpp @@ -571,7 +571,11 @@ Vec2i LuaArguments::getVec2i(int argumentIndex) const{ throwLuaError("Can not get vec2i from Lua state, value on the stack is not a table"); } +#if LUA_VERSION_NUM > 501 + if(lua_rawlen(luaState, argumentIndex)!=2){ +#else if(luaL_getn(luaState, argumentIndex)!=2){ +#endif throwLuaError("Can not get vec2i from Lua state, array size not 2"); } @@ -643,7 +647,11 @@ void LuaArguments::throwLuaError(const string &message) const{ stackString+= "String: " + string(luaL_checkstring(luaState, -i)); } else if(lua_istable(luaState, -i)){ +#if LUA_VERSION_NUM > 501 + stackString+= "Table (" + intToStr(lua_rawlen(luaState, -i)) + ")"; +#else stackString+= "Table (" + intToStr(luaL_getn(luaState, -i)) + ")"; +#endif } else {