mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-13 16:45:20 +02:00
Settings menu improvements regarding default values (#13489)
The reset button now removes the setting from minetest.conf instead of setting it to its default value. The reset button is now shown whenever a value is present in minetest.conf Float settings now get a .0 suffix if they have no decimal places.
This commit is contained in:
@@ -275,6 +275,18 @@ int LuaSettings::l_get_names(lua_State* L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// has(self, key) -> boolean
|
||||
int LuaSettings::l_has(lua_State* L)
|
||||
{
|
||||
NO_MAP_LOCK_REQUIRED;
|
||||
LuaSettings* o = checkObject<LuaSettings>(L, 1);
|
||||
|
||||
std::string key = std::string(luaL_checkstring(L, 2));
|
||||
lua_pushboolean(L, o->m_settings->existsLocal(key));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// write(self) -> success
|
||||
int LuaSettings::l_write(lua_State* L)
|
||||
{
|
||||
@@ -364,6 +376,7 @@ const luaL_Reg LuaSettings::methods[] = {
|
||||
luamethod(LuaSettings, set_np_group),
|
||||
luamethod(LuaSettings, remove),
|
||||
luamethod(LuaSettings, get_names),
|
||||
luamethod(LuaSettings, has),
|
||||
luamethod(LuaSettings, write),
|
||||
luamethod(LuaSettings, to_table),
|
||||
{0,0}
|
||||
|
@@ -59,6 +59,9 @@ private:
|
||||
// get_names(self) -> {key1, ...}
|
||||
static int l_get_names(lua_State *L);
|
||||
|
||||
// has(self, key) -> boolean
|
||||
static int l_has(lua_State *L);
|
||||
|
||||
// write(self) -> success
|
||||
static int l_write(lua_State *L);
|
||||
|
||||
|
Reference in New Issue
Block a user