diff --git a/stepmania/src/LuaManager.h b/stepmania/src/LuaManager.h index eba80dc735..fcc418feca 100644 --- a/stepmania/src/LuaManager.h +++ b/stepmania/src/LuaManager.h @@ -94,6 +94,14 @@ namespace LuaHelpers bool FromStack( int &Object, int iOffset, Lua *L ); bool FromStack( RString &Object, int iOffset, Lua *L ); + template + bool Pop( T &val, lua_State *L ) + { + bool bRet = LuaHelpers::FromStack( val, -1, L ); + lua_pop( L, 1 ); + return bRet; + } + template void ReadArrayFromTable( vector &aOut, lua_State *L ) { @@ -105,19 +113,11 @@ namespace LuaHelpers { lua_rawgeti( L, -1, i+1 ); T value = T(); - LuaHelpers::FromStack( value, -1, L ); + LuaHelpers::Pop( value, L ); aOut.push_back( value ); - lua_pop( L, 1 ); } } template - bool Pop( T &val, lua_State *L ) - { - bool bRet = LuaHelpers::FromStack( val, -1, L ); - lua_pop( L, 1 ); - return bRet; - } - template void CreateTableFromArray( const vector &aIn, lua_State *L ) { lua_newtable( L );