增加Lua函数

This commit is contained in:
2025-09-02 22:45:41 +08:00
parent 6788128cc3
commit 25e7cff75d
14 changed files with 260 additions and 22 deletions
+34
View File
@@ -0,0 +1,34 @@
#include "sgu_lua_utils.h"
#include "libNPK_Utils.h"
#include <strsafe.h>
#include <Shlwapi.h>
#include <algorithm>
extern "C"
{
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
};
#include "lua_tinker.h"
//utf8
bool luaForceCreatePathForFile(const char* szPath)
{
std::wstring strPath = convertUtf8StringToWide(szPath);
return forceCreatePathForFile(strPath.c_str());
}
//utf8
bool luaForceCreatePath(const char* szPath)
{
std::wstring strPath = convertUtf8StringToWide(szPath);
return forceCreatePath(strPath.c_str());
}
void registerUtilsLuaLibs(struct lua_State* L)
{
lua_tinker::def(L, "forceCreatePath", &luaForceCreatePath);
lua_tinker::def(L, "forceCreatePathForFile", &luaForceCreatePathForFile);
}