40 lines
787 B
C++
40 lines
787 B
C++
#include "sgu_mode_run_lua_file.h"
|
|
#include "sgu_lua_npk_file.h"
|
|
#include "sgu_lua_utils.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)
|
|
{
|
|
//NPK::IFileList* pNpkList = NPK::createEmptyFileList();
|
|
//pNpkList->loadListFromFile(L"d:\\output.txt", "sprite/",
|
|
// true, true, true, true, true,
|
|
// false);
|
|
|
|
//pNpkList->applyToLocalNPKFiles(L"D:\\WeGameApps\\地下城与勇士:创新世纪\\ImagePacks2");
|
|
//NPK::destoryFileList(pNpkList);
|
|
//return true;
|
|
|
|
lua_State* L = lua_open();
|
|
luaL_openlibs(L);
|
|
|
|
//register classes
|
|
registerNPKLuaLibs(L);
|
|
registerUtilsLuaLibs(L);
|
|
|
|
//run lua file
|
|
lua_tinker::dofile(L, szLuaFilename);
|
|
|
|
//cleanup
|
|
lua_close(L);
|
|
return true;
|
|
} |