From 6fe6baa241f15a5d9998e4bbad65ac4ac43a9b0f Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Tue, 26 Sep 2006 05:35:24 +0000 Subject: [PATCH] Unused. The purpose of this connivence function as stated in the comments (which isn't quite what it did) is exactly what RunExpression does. --- stepmania/src/LuaManager.cpp | 15 +++------------ stepmania/src/LuaManager.h | 4 ---- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/stepmania/src/LuaManager.cpp b/stepmania/src/LuaManager.cpp index b08af9e33d..c186e79817 100644 --- a/stepmania/src/LuaManager.cpp +++ b/stepmania/src/LuaManager.cpp @@ -504,27 +504,18 @@ bool LuaHelpers::RunScript( Lua *L, const RString &sScript, const RString &sName return true; } - -bool LuaHelpers::RunScript( Lua *L, const RString &sExpression, const RString &sName, int iReturnValues ) +bool LuaHelpers::RunExpression( Lua *L, const RString &sExpression, const RString &sName ) { RString sError; - if( !LuaHelpers::RunScript( L, sExpression, sName.size()? sName:RString("in"), sError, iReturnValues ) ) + if( !LuaHelpers::RunScript(L, "return " + sExpression, sName.empty() ? RString("in") : sName, sError, 1) ) { - sError = ssprintf( "Lua runtime error parsing \"%s\": %s", sName.size()? sName.c_str():sExpression.c_str(), sError.c_str() ); + sError = ssprintf( "Lua runtime error parsing \"%s\": %s", sName.size() ? sName.c_str() : sExpression.c_str(), sError.c_str() ); Dialog::OK( sError, "LUA_ERROR" ); return false; } - return true; } -bool LuaHelpers::RunExpression( Lua *L, const RString &sExpression, const RString &sName ) -{ - RString sFullExpression = "return " + sExpression; - - return LuaHelpers::RunScript( L, sFullExpression, sName, 1 ); -} - bool LuaHelpers::RunExpressionB( const RString &str ) { Lua *L = LUA->Get(); diff --git a/stepmania/src/LuaManager.h b/stepmania/src/LuaManager.h index a9f7da08c3..e5d5ce8a2a 100644 --- a/stepmania/src/LuaManager.h +++ b/stepmania/src/LuaManager.h @@ -51,10 +51,6 @@ namespace LuaHelpers * false is returned. */ bool RunScript( Lua *L, const RString &sScript, const RString &sName, RString &sError, int iReturnValues = 0 ); - /* Convenience: run a script with one return value, displaying an error on failure. - * The return value is left on the Lua stack. */ - bool RunScript( Lua *L, const RString &sExpression, const RString &sName = "", int iReturnValues = 0 ); - /* Run the given expression, returning a single value, and leave the return value on the * stack. On error, push nil. */ bool RunExpression( Lua *L, const RString &sExpression, const RString &sName = "" );