增加Lua导出和FileList
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include "sgu_mode_run_lua_file.h"
|
||||
#include "sgu_lua_npk_file.h"
|
||||
|
||||
#include "libNPK.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "lua.h"
|
||||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
};
|
||||
|
||||
#include "lua_tinker.h"
|
||||
|
||||
bool run_lua_file(const char* szLuaFilename)
|
||||
{
|
||||
lua_State* L = lua_open();
|
||||
luaL_openlibs(L);
|
||||
|
||||
//register global functions
|
||||
lua_tinker::def(L, "getLastErrorCode", &NPK::getLastErrorCode);
|
||||
lua_tinker::def(L, "getLastErrorMessage", &NPK::getLastErrorMessage);
|
||||
|
||||
//register classes
|
||||
LuaNPKFile::registerLuaApi(L);
|
||||
|
||||
//run lua file
|
||||
lua_tinker::dofile(L, szLuaFilename);
|
||||
|
||||
//cleanup
|
||||
lua_close(L);
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user