From a5814ec7d195be721cebde732d311be0f05c769a Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 30 Jul 2020 11:02:17 +0000 Subject: [PATCH] =?UTF-8?q?Include=20:=20-=20corretta=20funzione=20inline?= =?UTF-8?q?=20LuaChangeNameGlobVar=20perch=C3=A9=20non=20gestiva=20corrett?= =?UTF-8?q?amente=20lo=20stack=20di=20lua.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- EGnLuaAux.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/EGnLuaAux.h b/EGnLuaAux.h index ff86e89..0767a40 100644 --- a/EGnLuaAux.h +++ b/EGnLuaAux.h @@ -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 ; }