Revert empty form name deprecation warnings

This commit is contained in:
Lars Müller 2024-08-20 11:49:41 +02:00 committed by GitHub
parent ec115ffe2a
commit 9ccd9d341f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 12 deletions

View File

@ -6463,7 +6463,8 @@ Formspec
* `playername`: name of player to show formspec * `playername`: name of player to show formspec
* `formname`: name passed to `on_player_receive_fields` callbacks. * `formname`: name passed to `on_player_receive_fields` callbacks.
It should follow the `"modname:<whatever>"` naming convention. It should follow the `"modname:<whatever>"` naming convention.
`formname` must not be empty. * `formname` must not be empty, unless you want to reshow
the inventory formspec without updating it for future opens.
* `formspec`: formspec to display * `formspec`: formspec to display
* `minetest.close_formspec(playername, formname)` * `minetest.close_formspec(playername, formname)`
* `playername`: name of player to close formspec * `playername`: name of player to close formspec

View File

@ -426,18 +426,8 @@ int ModApiServer::l_show_formspec(lua_State *L)
NO_MAP_LOCK_REQUIRED; NO_MAP_LOCK_REQUIRED;
const char *playername = luaL_checkstring(L, 1); const char *playername = luaL_checkstring(L, 1);
const char *formname = luaL_checkstring(L, 2); const char *formname = luaL_checkstring(L, 2);
if (*formname == '\0') {
log_deprecated(L, "Deprecated call to `minetest.show_formspec`:"
"`formname` must not be empty");
}
const char *formspec = luaL_checkstring(L, 3); const char *formspec = luaL_checkstring(L, 3);
lua_pushboolean(L, getServer(L)->showFormspec(playername,formspec,formname));
if(getServer(L)->showFormspec(playername,formspec,formname))
{
lua_pushboolean(L, true);
}else{
lua_pushboolean(L, false);
}
return 1; return 1;
} }