world previews demo

This commit is contained in:
MihailRis
2024-04-23 01:09:30 +03:00
parent 5afa5304ff
commit 6e2bc9ca95
24 changed files with 153 additions and 59 deletions
-13
View File
@@ -19,18 +19,6 @@ namespace scripting {
extern lua::LuaState* state;
}
static int l_get_worlds_list(lua_State* L) {
auto paths = scripting::engine->getPaths();
auto worlds = paths->scanForWorlds();
lua_createtable(L, worlds.size(), 0);
for (size_t i = 0; i < worlds.size(); i++) {
lua_pushstring(L, worlds[i].filename().u8string().c_str());
lua_rawseti(L, -2, i + 1);
}
return 1;
}
static int l_new_world(lua_State* L) {
auto name = lua_tostring(L, 1);
auto seed = lua_tostring(L, 2);
@@ -183,7 +171,6 @@ static int l_get_generators(lua_State* L) {
}
const luaL_Reg corelib [] = {
{"get_worlds_list", lua_wrap_errors<l_get_worlds_list>},
{"new_world", lua_wrap_errors<l_new_world>},
{"open_world", lua_wrap_errors<l_open_world>},
{"close_world", lua_wrap_errors<l_close_world>},