LuaHelpers::RunExpressionF

This commit is contained in:
Glenn Maynard
2005-06-16 06:30:33 +00:00
parent 6a8940d5a4
commit cb3f10aabb
6 changed files with 15 additions and 10 deletions
+7 -2
View File
@@ -321,10 +321,14 @@ bool LuaHelpers::RunExpressionB( const CString &str )
return result;
}
float LuaManager::RunExpressionF( const CString &str )
float LuaHelpers::RunExpressionF( const CString &str )
{
Lua *L = LUA->Get();
if( !LuaHelpers::RunScript(L, "return " + str, "", 1) )
{
LUA->Release(L);
return 0;
}
/* Don't accept a function as a return value. */
if( lua_isfunction( L, -1 ) )
@@ -333,12 +337,13 @@ float LuaManager::RunExpressionF( const CString &str )
float result = (float) lua_tonumber( L, -1 );
lua_pop( L, 1 );
LUA->Release(L);
return result;
}
int LuaManager::RunExpressionI( const CString &str )
{
return (int)RunExpressionF(str);
return (int) LuaHelpers::RunExpressionF(str);
}
bool LuaManager::RunExpressionS( const CString &str, CString &sOut )