//---------------------------------------------------------------------------- // EgalTech 2015-2015 //---------------------------------------------------------------------------- // File : EgnLuaMgr.h Data : 21.03.15 Versione : 1.6c6 // Contenuto : Dichiarazione della classe LuaMgr. // // // // Modifiche : 21.03.15 DS Creazione modulo. // // //---------------------------------------------------------------------------- #pragma once #include //----------------------- Macro per import/export ----------------------------- #undef EGN_EXPORT #if defined( I_AM_EGN) // da definirsi solo nella DLL #define EGN_EXPORT __declspec( dllexport) #else #define EGN_EXPORT __declspec( dllimport) #endif //----------------------------------------------------------------------------- struct lua_State ; typedef int(*PFLUA) ( lua_State*) ; //---------------------------------------------------------------------------- class LuaMgr { public : EGN_EXPORT LuaMgr( void) : m_pL( nullptr) {} EGN_EXPORT ~LuaMgr( void) { Exit() ; } EGN_EXPORT bool Init( void) ; EGN_EXPORT bool Exit( void) ; EGN_EXPORT bool GetVersion( std::string& sLuaVer) ; EGN_EXPORT bool SetLuaLibsDir( const std::string& sDir) ; EGN_EXPORT bool Require( const std::string& sFile) ; EGN_EXPORT bool RegisterFunction( const std::string& sFunName, PFLUA pFun) ; EGN_EXPORT bool EvalNumExpr( const std::string& sExpr, double& dVal) ; EGN_EXPORT bool EvalStringExpr( const std::string& sExpr, std::string& sVal) ; EGN_EXPORT bool ExecLine( const std::string& sLine) ; EGN_EXPORT bool ExecFile( const std::string& sFile) ; EGN_EXPORT const std::string& GetLastError( void) { return m_sLastError ; } EGN_EXPORT const std::string& GetLuaLibsDir( void) { return m_sLuaLibsDir ; } EGN_EXPORT const std::string& GetLastRequire( void) { return m_sLastRequire ; } private : lua_State* m_pL ; std::string m_sLastError ; std::string m_sLuaLibsDir ; std::string m_sLastRequire ; } ;