mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02:00
Allow 'default' parameter in 'settings:get_bool' function
Default value is used when the setting key is not found in the config file. If default value is not set, 'nil' is returned. #6188
This commit is contained in:
@@ -100,7 +100,11 @@ int LuaSettings::l_get_bool(lua_State* L)
|
||||
bool value = o->m_settings->getBool(key);
|
||||
lua_pushboolean(L, value);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
// Push default value
|
||||
if (lua_isboolean(L, 3))
|
||||
lua_pushboolean(L, lua_toboolean(L, 3));
|
||||
else
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
Reference in New Issue
Block a user