minetest.setting_getbool

From Minetest Developer Wiki
Jump to: navigation, search

Contents

Syntax

Description

Returns either the boolean that is stored in minetest.conf under name, or nil if the variable is not found.

This function reads a string. If the string equals any of y, yes, true, or 1, then it is considered true; else, it is considered false.

Example

local dmg = minetest.setting_getbool("enable_damage")
if (dmg == nil) then
    -- Set up a suitable default value
    dmg = true
end
if (dmg) then
    player:sethp(player:gethp() - 1)
end

See Also

Personal tools
Namespaces

Variants
Actions
Navigation
API
Toolbox