Include :
- migliorati controlli in accesso a campi di tavole Lua.
This commit is contained in:
@@ -438,6 +438,8 @@ LuaGetGlobVar( lua_State* L, const std::string& sVar, T& Val)
|
||||
std::string sTab, sField ;
|
||||
SplitFirst( sVar, ".", sTab, sField) ;
|
||||
lua_getglobal( L, sTab.c_str()) ;
|
||||
if ( ! lua_istable( L, -1))
|
||||
return false ;
|
||||
bool bOk = LuaGetTabFieldParam( L, -1, sField.c_str(), Val) ;
|
||||
lua_pop( L, 1) ;
|
||||
return bOk ;
|
||||
|
||||
@@ -101,6 +101,8 @@ LuaMgr::CallFunction( const std::string& sFunName, int nRets, const Args&... par
|
||||
std::string sTab, sField ;
|
||||
SplitFirst( sFunName, ".", sTab, sField) ;
|
||||
lua_getglobal( m_pL, sTab.c_str()) ;
|
||||
if ( ! lua_istable( m_pL, -1))
|
||||
return false ;
|
||||
lua_getfield( m_pL, -1, sField.c_str()) ;
|
||||
// porto la funzione uno slot sotto e diminuisco lo stack di uno (per essere come caso sopra)
|
||||
lua_copy( m_pL, -1, -2) ;
|
||||
|
||||
Reference in New Issue
Block a user