add file.read_combined_list(...)

This commit is contained in:
MihailRis
2024-09-30 01:55:42 +03:00
parent f20a0dfae0
commit e590d06bb0
5 changed files with 63 additions and 8 deletions
+9
View File
@@ -247,6 +247,14 @@ static int l_file_gzip_decompress(lua::State* L) {
}
}
static int l_file_read_combined_list(lua::State* L) {
std::string path = lua::require_string(L, 1);
if (path.find(':') != std::string::npos) {
throw std::runtime_error("entry point must not be specified");
}
return lua::pushvalue(L, engine->getResPaths()->readCombinedList(path));
}
const luaL_Reg filelib[] = {
{"exists", lua::wrap<l_file_exists>},
{"find", lua::wrap<l_file_find>},
@@ -265,4 +273,5 @@ const luaL_Reg filelib[] = {
{"write", lua::wrap<l_file_write>},
{"gzip_compress", lua::wrap<l_file_gzip_compress>},
{"gzip_decompress", lua::wrap<l_file_gzip_decompress>},
{"read_combined_list", lua::wrap<l_file_read_combined_list>},
{NULL, NULL}};