diff options
Diffstat (limited to 'tests/tolua/test1.cpp')
-rwxr-xr-x | tests/tolua/test1.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/tolua/test1.cpp b/tests/tolua/test1.cpp new file mode 100755 index 0000000..a2e91cb --- /dev/null +++ b/tests/tolua/test1.cpp @@ -0,0 +1,43 @@ +#include "Logger.hpp" +#include "LuaVM.hpp" +#include "ModuleLoader.hpp" +#include "Base.hpp" + +#include <stdexcept> +#include <vector> + +using namespace std; + +int main( int /* argc */, char *argv[] ) +{ + try { + Logger::instance( ).openConsoleLog( logDEBUG ); + + LuaVM luaVm; + + vector<string> modules; + modules.push_back( "./libtest1/mod_test.so" ); + ModuleLoader<Base> loader( modules ); + + Logger::instance( ).openConsoleLog( logDEBUG ); + + luaVm.loadSource( argv[1] ); + luaVm.executeMain( ); + + //luaVm.dumpState( ); + + //Base *obj = loader.create( "testmod" ); + //obj->hello( ); + //loader.destroy( obj ); + + return 0; + } catch( exception &e ) { + LOG( logFATAL ) << "ERROR: " << e.what( ); + return 1; + } catch( ... ) { + LOG( logFATAL ) << "ERROR: unknown exception!"; + return 1; + } + + return 0; +} |