lua: core.open_world

This commit is contained in:
MihailRis
2024-03-20 23:55:04 +03:00
parent 0140fb8e3e
commit 567c8a365f
3 changed files with 31 additions and 6 deletions
+9
View File
@@ -3,6 +3,7 @@
#include "../../../engine.h"
#include "../../../files/engine_paths.h"
#include "../../../frontend/menu/menu.h"
#include "../scripting.h"
#include <vector>
@@ -19,7 +20,15 @@ static int l_get_worlds_list(lua_State* L) {
return 1;
}
static int l_open_world(lua_State* L) {
auto name = lua_tostring(L, 1);
scripting::engine->setScreen(nullptr);
menus::open_world(name, scripting::engine, false);
return 0;
}
const luaL_Reg corelib [] = {
{"get_worlds_list", lua_wrap_errors<l_get_worlds_list>},
{"open_world", lua_wrap_errors<l_open_world>},
{NULL, NULL}
};