EgtGeneral 2.3b1 :
- piccola miglioria nel controllo di alcune chiamate lua.
This commit is contained in:
+12
-4
@@ -157,7 +157,9 @@ LuaMgr::EvalExpr( const string& sExpr, double& dVal)
|
||||
// completo la stringa da valutare
|
||||
string sEval = "return " + sExpr ;
|
||||
// valuto l'espressione
|
||||
int nErr = luaL_loadstring( m_pL, sEval.c_str()) || lua_pcall( m_pL, 0, 1, 0) ;
|
||||
int nErr = luaL_loadstring( m_pL, sEval.c_str()) ;
|
||||
if ( nErr == LUA_OK)
|
||||
nErr = lua_pcall( m_pL, 0, 1, 0) ;
|
||||
// senza errori
|
||||
if ( nErr == LUA_OK && lua_type( m_pL, -1) == LUA_TNUMBER) {
|
||||
dVal = lua_tonumber( m_pL, -1) ;
|
||||
@@ -195,7 +197,9 @@ LuaMgr::EvalExpr( const string& sExpr, string& sVal)
|
||||
// completo la stringa da valutare
|
||||
string sEval = "return " + sExpr ;
|
||||
// valuto l'espressione
|
||||
int nErr = luaL_loadstring( m_pL, sEval.c_str()) || lua_pcall( m_pL, 0, 1, 0) ;
|
||||
int nErr = luaL_loadstring( m_pL, sEval.c_str()) ;
|
||||
if ( nErr == LUA_OK)
|
||||
lua_pcall( m_pL, 0, 1, 0) ;
|
||||
// senza errori
|
||||
if ( nErr == LUA_OK && lua_type( m_pL, -1) == LUA_TSTRING) {
|
||||
sVal = lua_tostring( m_pL, -1) ;
|
||||
@@ -223,7 +227,9 @@ LuaMgr::ExecLine( const string& sLine)
|
||||
if ( m_pL == nullptr)
|
||||
return false ;
|
||||
// eseguo la linea
|
||||
int nErr = luaL_loadstring( m_pL, sLine.c_str()) || lua_pcall( m_pL, 0, LUA_MULTRET, 0) ;
|
||||
int nErr = luaL_loadstring( m_pL, sLine.c_str()) ;
|
||||
if ( nErr == LUA_OK)
|
||||
lua_pcall( m_pL, 0, LUA_MULTRET, 0) ;
|
||||
// senza errori
|
||||
if ( nErr == LUA_OK) {
|
||||
m_sLastError.clear() ;
|
||||
@@ -249,7 +255,9 @@ LuaMgr::ExecFile( const string& sFile)
|
||||
if ( m_pL == nullptr)
|
||||
return false ;
|
||||
// eseguo la linea
|
||||
int nErr = luaL_loadfile( m_pL, sFile.c_str()) || lua_pcall( m_pL, 0, LUA_MULTRET, 0) ;
|
||||
int nErr = luaL_loadfile( m_pL, sFile.c_str()) ;
|
||||
if ( nErr == LUA_OK)
|
||||
lua_pcall( m_pL, 0, LUA_MULTRET, 0) ;
|
||||
// senza errori
|
||||
if ( nErr == LUA_OK) {
|
||||
m_sLastError.clear() ;
|
||||
|
||||
Reference in New Issue
Block a user