In-game settings menu using separate Lua environment (#15614)

This commit is contained in:
grorp
2025-01-19 13:07:04 -05:00
committed by GitHub
parent 3cb07d5fb6
commit eeb6cab4c4
48 changed files with 652 additions and 290 deletions

View File

@@ -127,21 +127,6 @@ int ModApiClient::l_get_player_names(lua_State *L)
return 1;
}
// show_formspec(formspec)
int ModApiClient::l_show_formspec(lua_State *L)
{
if (!lua_isstring(L, 1) || !lua_isstring(L, 2))
return 0;
ClientEvent *event = new ClientEvent();
event->type = CE_SHOW_LOCAL_FORMSPEC;
event->show_formspec.formname = new std::string(luaL_checkstring(L, 1));
event->show_formspec.formspec = new std::string(luaL_checkstring(L, 2));
getClient(L)->pushToEventQueue(event);
lua_pushboolean(L, true);
return 1;
}
// disconnect()
int ModApiClient::l_disconnect(lua_State *L)
{
@@ -325,7 +310,6 @@ void ModApiClient::Initialize(lua_State *L, int top)
API_FCT(send_chat_message);
API_FCT(clear_out_chat_queue);
API_FCT(get_player_names);
API_FCT(show_formspec);
API_FCT(gettext);
API_FCT(get_node_or_nil);
API_FCT(disconnect);