natiny.script.to_bool

Lua
natiny.script.to_bool(value) -> boolean

Reads any value the way the script would: everything is true except nil and false.

Parameters

Name Type Description
value any What to read

Returns

Type Description
boolean false for nil and false, true for everything else

Example

Lua
local vsync = natiny.script.table_get(mod, config, "vsync")

if natiny.script.to_bool(vsync) then
    natiny.window.set_vsync(window, true)
end