Include :

- corretta funzione inline LuaChangeNameGlobVar perché non gestiva correttamente lo stack di lua.
This commit is contained in:
Dario Sassi
2020-07-30 11:02:17 +00:00
parent dbab058281
commit a5814ec7d1
+5 -3
View File
@@ -1,13 +1,13 @@
//----------------------------------------------------------------------------
// EgalTech 2015-2020
//----------------------------------------------------------------------------
// File : EGnLuaAux.h Data : 17.04.20 Versione : 2.2d3
// File : EGnLuaAux.h Data : 30.07.20 Versione : 2.2g1
// Contenuto : Funzioni per gestione parametri generali con LUA.
//
//
//
// Modifiche : 21.03.15 DS Creazione modulo.
//
// 30.07.20 DS Corretta LuaChangeNameGlobVar (mancava pop se non c'è var).
//
//----------------------------------------------------------------------------
@@ -557,8 +557,10 @@ inline bool
LuaChangeNameGlobVar( lua_State* L, const std::string& sOldVar, const std::string& sNewVar)
{
int nType = lua_getglobal( L, sOldVar.c_str()) ;
if ( nType == LUA_TNONE || nType == LUA_TNIL)
if ( nType == LUA_TNONE || nType == LUA_TNIL) {
lua_pop( L, 1) ;
return false ;
}
lua_setglobal( L, sNewVar.c_str()) ;
return true ;
}