LuaHelpers::RunExpression
This commit is contained in:
@@ -539,6 +539,17 @@ bool LuaHelpers::RunScript( Lua *L, const RString &sExpression, const RString &s
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LuaHelpers::RunExpression( Lua *L, const RString &sExpression )
|
||||
{
|
||||
RString sFullExpression = "return " + sExpression;
|
||||
|
||||
bool bSuccess = LuaHelpers::RunScript( L, sFullExpression, "", 1 );
|
||||
if( !bSuccess )
|
||||
lua_pushnil( L );
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool LuaHelpers::RunExpressionB( const RString &str )
|
||||
{
|
||||
Lua *L = LUA->Get();
|
||||
|
||||
@@ -56,6 +56,10 @@ namespace LuaHelpers
|
||||
* 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 );
|
||||
|
||||
bool RunScriptFile( const RString &sFile );
|
||||
|
||||
/* Strip "//" comments and "+". */
|
||||
|
||||
Reference in New Issue
Block a user