File tree 2 files changed +8
-2
lines changed
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -4131,7 +4131,9 @@ It can be created via `Settings(filename)`.
4131
4131
4132
4132
#### Methods
4133
4133
* `get(key)`: returns a value
4134
- * `get_bool(key)`: returns a boolean
4134
+ * `get_bool(key, [default])`: returns a boolean
4135
+ * `default` is the value returned if `key` is not found.
4136
+ * Returns `nil` if `key` is not found and `default` not specified.
4135
4137
* `get_np_group(key)`: returns a NoiseParams table
4136
4138
* `set(key, value)`
4137
4139
* Setting names can't contain whitespace or any of `="{}#`.
Original file line number Diff line number Diff line change @@ -100,7 +100,11 @@ int LuaSettings::l_get_bool(lua_State* L)
100
100
bool value = o->m_settings ->getBool (key);
101
101
lua_pushboolean (L, value);
102
102
} else {
103
- lua_pushnil (L);
103
+ // Push default value
104
+ if (lua_isboolean (L, 3 ))
105
+ lua_pushboolean (L, lua_toboolean (L, 3 ));
106
+ else
107
+ lua_pushnil (L);
104
108
}
105
109
106
110
return 1 ;
You can’t perform that action at this time.
0 commit comments