diff --git a/EgtGeneral.rc b/EgtGeneral.rc index efcf23f..10b34b0 100644 Binary files a/EgtGeneral.rc and b/EgtGeneral.rc differ diff --git a/LuaManager.cpp b/LuaManager.cpp index 92ae0b6..6b0eedc 100644 --- a/LuaManager.cpp +++ b/LuaManager.cpp @@ -241,6 +241,30 @@ LuaMgr::ExecFile( const string& sFile) } } +//---------------------------------------------------------------------------- +bool +LuaMgr::ExistsFunction( const string& sFunName) +{ + // recupero la funzione + if ( sFunName.find( '.') == std::string::npos) { + // è direttamente il nome + lua_getglobal( m_pL, sFunName.c_str()) ; + } + else { + // è in una tavola + std::string sTab, sField ; + SplitFirst( sFunName, ".", sTab, sField) ; + lua_getglobal( m_pL, sTab.c_str()) ; + 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) ; + lua_pop( m_pL, 1) ; + } + bool bOk = ( lua_isfunction( m_pL, -1) != 0) ; + lua_pop( m_pL, 1) ; + return bOk ; +} + //---------------------------------------------------------------------------- void LuaMgr::LogError( const string& sErr)