ソースを参照

fixed potential(?) bug where temporary lua variables were left on the stack after calls to lua_len

Ben Bromberg 12 年 前
コミット
a1ab170777
2 ファイル変更2 行追加0 行削除
  1. 1 0
      gameplay/src/ScriptController.cpp
  2. 1 0
      gameplay/src/ScriptController.inl

+ 1 - 0
gameplay/src/ScriptController.cpp

@@ -22,6 +22,7 @@
     /* Get the size of the array. */ \
     lua_len(sc->_lua, index); \
     int size = luaL_checkint(sc->_lua, -1); \
+    lua_pop(sc->_lua, 1); \
     if (size <= 0) \
         return LuaArray<type>((type*)NULL); \
     \

+ 1 - 0
gameplay/src/ScriptController.inl

@@ -121,6 +121,7 @@ ScriptUtil::LuaArray<T> ScriptUtil::getObjectPointer(int index, const char* type
         // Get the size of the array.
         lua_len(sc->_lua, index);
         int size = luaL_checkint(sc->_lua, -1);
+        lua_pop(sc->_lua, 1);
 
         if (size <= 0)
         {