lua: 'core' prefix support + minor refactor

This commit is contained in:
MihailRis
2024-01-23 23:52:42 +03:00
parent 2aaa37bb7d
commit e457e3da39
2 changed files with 8 additions and 3 deletions
+6
View File
@@ -43,6 +43,12 @@ static const luaL_Reg timelib [] = {
/* == pack library == */
static int l_pack_get_folder(lua_State* L) {
std::string packName = lua_tostring(L, 1);
if (packName == "core") {
auto folder = scripting::engine->getPaths()
->getResources().u8string()+"/";
lua_pushstring(L, folder.c_str());
return 1;
}
for (auto& pack : scripting::engine->getContentPacks()) {
if (pack.id == packName) {
lua_pushstring(L, (pack.folder.u8string()+"/").c_str());