diff --git a/stepmania/src/Actor.cpp b/stepmania/src/Actor.cpp index b1145938fb..bbc2751f06 100644 --- a/stepmania/src/Actor.cpp +++ b/stepmania/src/Actor.cpp @@ -208,7 +208,7 @@ void Actor::LoadFromNode( const RString& sDir, const XNode* pNode ) Lua *L = LUA->Get(); this->PushSelf( L ); - LuaHelpers::Push( sName, L ); + LuaHelpers::Push( L, sName ); ActorUtil::GetParam( L, sName ); if( lua_isnil(L, -1) && !bOptional ) diff --git a/stepmania/src/ActorUtil.cpp b/stepmania/src/ActorUtil.cpp index c12cd2bb00..8a57e42a6c 100644 --- a/stepmania/src/ActorUtil.cpp +++ b/stepmania/src/ActorUtil.cpp @@ -135,7 +135,7 @@ void ActorUtil::SetParamFromStack( Lua *L, RString sName, LuaReference *pOld ) PushParamsTable( L ); int iParams = lua_gettop(L); - LuaHelpers::Push( sName, L ); + LuaHelpers::Push( L, sName ); int iName = lua_gettop(L); /* Save the old value. */ @@ -165,7 +165,7 @@ void ActorUtil::GetParam( Lua *L, const RString &sName ) { /* Search the params table. */ PushParamsTable( L ); - LuaHelpers::Push( sName, L ); + LuaHelpers::Push( L, sName ); lua_rawget( L, -2 ); lua_remove( L, -2 ); @@ -628,7 +628,7 @@ ActorUtil::ActorParam::ActorParam( RString sName, RString sValue ) m_pOld = new LuaReference; m_sName = sName; Lua *L = LUA->Get(); - LuaHelpers::Push( sValue, L ); + LuaHelpers::Push( L, sValue ); ActorUtil::SetParamFromStack( L, m_sName, m_pOld ); LUA->Release( L ); } diff --git a/stepmania/src/CourseEntryDisplay.cpp b/stepmania/src/CourseEntryDisplay.cpp index bea416d21a..f16394b062 100644 --- a/stepmania/src/CourseEntryDisplay.cpp +++ b/stepmania/src/CourseEntryDisplay.cpp @@ -81,9 +81,9 @@ void CourseEntryDisplay::SetDifficulty( PlayerNumber pn, const RString &text, Di return; Lua *L = LUA->Get(); - LuaHelpers::Push( dc, L ); + LuaHelpers::Push( L, dc ); m_textDifficultyNumber[pn].m_pLuaInstance->Set( L, "Difficulty" ); - LuaHelpers::Push( dc, L ); + LuaHelpers::Push( L, dc ); m_textFoot[pn].m_pLuaInstance->Set( L, "Difficulty" ); LUA->Release(L); diff --git a/stepmania/src/DifficultyMeter.cpp b/stepmania/src/DifficultyMeter.cpp index 2eaf04de96..5dcc4c24c9 100644 --- a/stepmania/src/DifficultyMeter.cpp +++ b/stepmania/src/DifficultyMeter.cpp @@ -203,9 +203,9 @@ void DifficultyMeter::SetInternal( int iMeter, Difficulty dc, const RString &sDi sNewText.insert( sNewText.end(), iNumOff, off ); Lua *L = LUA->Get(); - LuaHelpers::Push( dc, L ); + LuaHelpers::Push( L, dc ); m_textFeet.m_pLuaInstance->Set( L, "Difficulty" ); - LuaHelpers::Push( iMeter, L ); + LuaHelpers::Push( L, iMeter ); m_textFeet.m_pLuaInstance->Set( L, "Meter" ); LUA->Release(L); m_textFeet.PlayCommand( "DifficultyChanged" ); diff --git a/stepmania/src/DynamicActorScroller.cpp b/stepmania/src/DynamicActorScroller.cpp index 4fd7ed2fa0..a189522e5e 100644 --- a/stepmania/src/DynamicActorScroller.cpp +++ b/stepmania/src/DynamicActorScroller.cpp @@ -116,7 +116,7 @@ void DynamicActorScroller::ConfigureActor( Actor *pActor, int iItem ) m_LoadFunction.PushSelf( L ); ASSERT( !lua_isnil(L, -1) ); pActor->PushSelf( L ); - LuaHelpers::Push( iItem, L ); + LuaHelpers::Push( L, iItem ); lua_call( L, 2, 0 ); // 2 args, 0 results LUA->Release(L); } diff --git a/stepmania/src/EnumHelper.cpp b/stepmania/src/EnumHelper.cpp index c797678725..7ff8f53590 100644 --- a/stepmania/src/EnumHelper.cpp +++ b/stepmania/src/EnumHelper.cpp @@ -23,7 +23,7 @@ int CheckEnum( lua_State *L, LuaReference &table, int iPos, int iInvalid, const lua_pushvalue( L, iPos ); RString sGot; LuaHelpers::Pop( L, sGot ); - LuaHelpers::Push( ssprintf("Expected %s; got \"%s\"", szType, sGot.c_str() ), L ); + LuaHelpers::Push( L, ssprintf("Expected %s; got \"%s\"", szType, sGot.c_str() ) ); lua_error( L ); } int iRet = lua_tointeger( L, -1 ); diff --git a/stepmania/src/EnumHelper.h b/stepmania/src/EnumHelper.h index 91511cfa63..2bed41e5f3 100644 --- a/stepmania/src/EnumHelper.h +++ b/stepmania/src/EnumHelper.h @@ -132,7 +132,7 @@ static const RString EMPTY_STRING; #define LuaDeclareType(X) \ namespace LuaHelpers { bool FromStack( lua_State *L, X &Object, int iOffset ); } \ -namespace LuaHelpers { void Push( const X &Object, lua_State *L ); } +namespace LuaHelpers { void Push( lua_State *L, const X &Object ); } #define LuaXType(X) \ static void Lua##X(lua_State* L) \ @@ -168,7 +168,7 @@ LuaReference EnumTraits::EnumToString; \ X EnumTraits::Invalid; \ const char *EnumTraits::szName = #X; \ namespace LuaHelpers { bool FromStack( lua_State *L, X &Object, int iOffset ) { Object = Enum::Check( L, iOffset ); return true; } } \ -namespace LuaHelpers { void Push( const X &Object, lua_State *L ) { Enum::Push( L, Object ); } } +namespace LuaHelpers { void Push( lua_State *L, const X &Object ) { Enum::Push( L, Object ); } } #endif diff --git a/stepmania/src/LuaBinding.h b/stepmania/src/LuaBinding.h index 1c2e9bf353..75f43962b5 100644 --- a/stepmania/src/LuaBinding.h +++ b/stepmania/src/LuaBinding.h @@ -241,10 +241,10 @@ public: template<> Luna::RegTypeVector* Luna::s_pvMethods = NULL; \ static Luna##T registera##T; \ /* Call PushSelf, so we always call the derived Luna::Push. */ \ - namespace LuaHelpers { template<> void Push( T *pObject, lua_State *L ) { pObject->PushSelf( L ); } } + namespace LuaHelpers { template<> void Push( lua_State *L, T *pObject ) { pObject->PushSelf( L ); } } #define DEFINE_METHOD( method_name, expr ) \ - static int method_name( T* p, lua_State *L ) { LuaHelpers::Push( p->expr, L ); return 1; } + static int method_name( T* p, lua_State *L ) { LuaHelpers::Push( L, p->expr ); return 1; } #define ADD_METHOD( method_name ) \ AddMethod( #method_name, method_name ) diff --git a/stepmania/src/LuaExpressionTransform.cpp b/stepmania/src/LuaExpressionTransform.cpp index 7fae7c1c55..bbebae30e3 100644 --- a/stepmania/src/LuaExpressionTransform.cpp +++ b/stepmania/src/LuaExpressionTransform.cpp @@ -31,9 +31,9 @@ const Actor::TweenState &LuaExpressionTransform::GetPosition( float fPositionOff m_exprTransformFunction.PushSelf( L ); ASSERT( !lua_isnil(L, -1) ); a.PushSelf( L ); - LuaHelpers::Push( fPositionOffsetFromCenter, L ); - LuaHelpers::Push( iItemIndex, L ); - LuaHelpers::Push( iNumItems, L ); + LuaHelpers::Push( L, fPositionOffsetFromCenter ); + LuaHelpers::Push( L, iItemIndex ); + LuaHelpers::Push( L, iNumItems ); lua_call( L, 4, 0 ); // 4 args, 0 results LUA->Release(L); diff --git a/stepmania/src/LuaFunctions.h b/stepmania/src/LuaFunctions.h index b0658c5194..2323465ab6 100644 --- a/stepmania/src/LuaFunctions.h +++ b/stepmania/src/LuaFunctions.h @@ -14,7 +14,7 @@ struct LuaFunctionList #define LuaFunction( func, expr ) \ int LuaFunc_##func( lua_State *L ) { \ - LuaHelpers::Push( expr, L ); return 1; \ + LuaHelpers::Push( L, expr ); return 1; \ } \ static LuaFunctionList g_##func( #func, LuaFunc_##func ); /* register it */ diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index 80f067571f..b33de61208 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -48,7 +48,7 @@ const char *ChunkReaderString::Reader( lua_State *L, void *pPtr, size_t *pSize ) void LuaManager::SetGlobal( const RString &sName, int val ) { Lua *L = LUA->Get(); - LuaHelpers::Push( val, L ); + LuaHelpers::Push( L, val ); lua_setglobal( L, sName ); LUA->Release( L ); } @@ -56,7 +56,7 @@ void LuaManager::SetGlobal( const RString &sName, int val ) void LuaManager::SetGlobal( const RString &sName, const RString &val ) { Lua *L = LUA->Get(); - LuaHelpers::Push( val, L ); + LuaHelpers::Push( L, val ); lua_setglobal( L, sName ); LUA->Release( L ); } @@ -70,10 +70,10 @@ void LuaManager::UnsetGlobal( const RString &sName ) } -void LuaHelpers::Push( const bool &Object, lua_State *L ) { lua_pushboolean( L, Object ); } -void LuaHelpers::Push( const float &Object, lua_State *L ) { lua_pushnumber( L, Object ); } -void LuaHelpers::Push( const int &Object, lua_State *L ) { lua_pushinteger( L, Object ); } -void LuaHelpers::Push( const RString &Object, lua_State *L ) { lua_pushlstring( L, Object.data(), Object.size() ); } +void LuaHelpers::Push( lua_State *L, const bool &Object ) { lua_pushboolean( L, Object ); } +void LuaHelpers::Push( lua_State *L, const float &Object ) { lua_pushnumber( L, Object ); } +void LuaHelpers::Push( lua_State *L, const int &Object ) { lua_pushinteger( L, Object ); } +void LuaHelpers::Push( lua_State *L, const RString &Object ) { lua_pushlstring( L, Object.data(), Object.size() ); } bool LuaHelpers::FromStack( Lua *L, bool &Object, int iOffset ) { Object = !!lua_toboolean( L, iOffset ); return true; } bool LuaHelpers::FromStack( Lua *L, float &Object, int iOffset ) { Object = (float)lua_tonumber( L, iOffset ); return true; } diff --git a/stepmania/src/LuaManager.h b/stepmania/src/LuaManager.h index d7ae25d20e..1722181cee 100644 --- a/stepmania/src/LuaManager.h +++ b/stepmania/src/LuaManager.h @@ -77,12 +77,12 @@ namespace LuaHelpers bool RunAtExpressionS( RString &sStr ); template - void Push( T *pObject, Lua *L ); + void Push( lua_State *L, T *pObject ); - void Push( const bool &Object, Lua *L ); - void Push( const float &Object, Lua *L ); - void Push( const int &Object, Lua *L ); - void Push( const RString &Object, Lua *L ); + void Push( lua_State *L, const bool &Object ); + void Push( lua_State *L, const float &Object ); + void Push( lua_State *L, const int &Object ); + void Push( lua_State *L, const RString &Object ); bool FromStack( Lua *L, bool &Object, int iOffset ); bool FromStack( Lua *L, float &Object, int iOffset ); @@ -118,7 +118,7 @@ namespace LuaHelpers lua_newtable( L ); for( unsigned i = 0; i < aIn.size(); ++i ) { - LuaHelpers::Push( aIn[i], L ); + LuaHelpers::Push( L, aIn[i] ); lua_rawseti( L, -2, i+1 ); } } diff --git a/stepmania/src/MenuTimer.cpp b/stepmania/src/MenuTimer.cpp index 546b94886a..ee88187c65 100644 --- a/stepmania/src/MenuTimer.cpp +++ b/stepmania/src/MenuTimer.cpp @@ -164,7 +164,7 @@ void MenuTimer::SetText( float fSeconds ) ASSERT( !lua_isnil(L, -1) ); // 1st parameter - LuaHelpers::Push( fSeconds, L ); + LuaHelpers::Push( L, fSeconds ); // call function with 1 argument and 1 result lua_call(L, 1, 1); diff --git a/stepmania/src/OptionRowHandler.cpp b/stepmania/src/OptionRowHandler.cpp index 86833df70f..ac6ee01f7a 100644 --- a/stepmania/src/OptionRowHandler.cpp +++ b/stepmania/src/OptionRowHandler.cpp @@ -950,7 +950,7 @@ public: lua_pushvalue( L, 1 ); /* Argument 3 (pn): */ - LuaHelpers::Push( p, L ); + LuaHelpers::Push( L, p ); ASSERT( lua_gettop(L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */ @@ -1004,7 +1004,7 @@ public: lua_pushvalue( L, 1 ); /* Argument 3 (pn): */ - LuaHelpers::Push( p, L ); + LuaHelpers::Push( L, p ); ASSERT( lua_gettop(L) == 6 ); /* vbSelectedOut, m_iLuaTable, function, self, arg, arg */ diff --git a/stepmania/src/PercentageDisplay.cpp b/stepmania/src/PercentageDisplay.cpp index 839b829097..71db86f971 100644 --- a/stepmania/src/PercentageDisplay.cpp +++ b/stepmania/src/PercentageDisplay.cpp @@ -167,7 +167,7 @@ void PercentageDisplay::Refresh() Lua *L = LUA->Get(); m_Format.PushSelf( L ); ASSERT( !lua_isnil(L, -1) ); - LuaHelpers::Push( fPercentDancePoints, L ); + LuaHelpers::Push( L, fPercentDancePoints ); lua_call( L, 1, 1 ); // 1 args, 1 result LuaHelpers::Pop( L, sNumToDisplay ); LUA->Release(L); diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index 0509265296..258d8d3634 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -191,13 +191,13 @@ void Player::Init( expr.PushSelf( L ); ASSERT( !lua_isnil(L, -1) ); temp.PushSelf( L ); - LuaHelpers::Push( pPlayerState->m_PlayerNumber, L ); - LuaHelpers::Push( pPlayerState->m_mp, L ); - LuaHelpers::Push( iEnabledPlayerIndex, L ); - LuaHelpers::Push( iNumEnabledPlayers, L ); - LuaHelpers::Push( bPlayerUsingBothSides, L ); - LuaHelpers::Push( !!i, L ); - LuaHelpers::Push( !!j, L ); + LuaHelpers::Push( L, pPlayerState->m_PlayerNumber ); + LuaHelpers::Push( L, pPlayerState->m_mp ); + LuaHelpers::Push( L, iEnabledPlayerIndex ); + LuaHelpers::Push( L, iNumEnabledPlayers ); + LuaHelpers::Push( L, bPlayerUsingBothSides ); + LuaHelpers::Push( L, !!i ); + LuaHelpers::Push( L, !!j ); lua_call( L, 8, 0 ); // 8 args, 0 results LUA->Release(L); @@ -226,13 +226,13 @@ void Player::Init( expr.PushSelf( L ); ASSERT( !lua_isnil(L, -1) ); m_sprJudgmentFrame->PushSelf( L ); - LuaHelpers::Push( pPlayerState->m_PlayerNumber, L ); - LuaHelpers::Push( pPlayerState->m_mp, L ); - LuaHelpers::Push( iEnabledPlayerIndex, L ); - LuaHelpers::Push( iNumEnabledPlayers, L ); - LuaHelpers::Push( bPlayerUsingBothSides, L ); - LuaHelpers::Push( false, L ); - LuaHelpers::Push( false, L ); + LuaHelpers::Push( L, pPlayerState->m_PlayerNumber ); + LuaHelpers::Push( L, pPlayerState->m_mp ); + LuaHelpers::Push( L, iEnabledPlayerIndex ); + LuaHelpers::Push( L, iNumEnabledPlayers ); + LuaHelpers::Push( L, bPlayerUsingBothSides ); + LuaHelpers::Push( L, false ); + LuaHelpers::Push( L, false ); lua_call( L, 8, 0 ); // 8 args, 0 results LUA->Release( L ); } diff --git a/stepmania/src/Preference.cpp b/stepmania/src/Preference.cpp index 94df56caae..088156498b 100644 --- a/stepmania/src/Preference.cpp +++ b/stepmania/src/Preference.cpp @@ -89,7 +89,7 @@ void IPreference::SetFromStack( lua_State *L ) } \ template<> void PrefPushValue( lua_State *L, const type &v ) \ { \ - LuaHelpers::Push( v, L ); \ + LuaHelpers::Push( L, v ); \ } READFROM_AND_WRITETO( int ) diff --git a/stepmania/src/ScreenOptions.cpp b/stepmania/src/ScreenOptions.cpp index 1e91755cd0..5501a704ac 100644 --- a/stepmania/src/ScreenOptions.cpp +++ b/stepmania/src/ScreenOptions.cpp @@ -223,7 +223,7 @@ void ScreenOptions::InitMenu( const vector &vHands ) int iIndex = p - m_pRows.begin(); Lua *L = LUA->Get(); - LuaHelpers::Push( iIndex, L ); + LuaHelpers::Push( L, iIndex ); (*p)->m_pLuaInstance->Set( L, "iIndex" ); LUA->Release( L ); diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index d54991575c..609948652a 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -1870,8 +1870,8 @@ public: p->GetExtraStageInfo( bExtra2, pStyle, pSong, pSteps, &po, &so ); pSong->PushSelf( L ); pSteps->PushSelf( L ); - LuaHelpers::Push( po.GetString(true), L ); - LuaHelpers::Push( so.GetString(), L ); + LuaHelpers::Push( L, po.GetString(true) ); + LuaHelpers::Push( L, so.GetString() ); return 4; }