Types/bool: Difference between revisions
m (formatting) |
(Migrated prototype doc to separate website) |
||
Line 1: | Line 1: | ||
'''The prototype docs have moved to a new website with an improved format.''' This documentation page can now be found here: [https://lua-api.factorio.com/latest/types/bool.html https://lua-api.factorio.com/latest/types/bool.html] | |||
This wiki page is no longer updated and '''will be removed at some point in the future''', so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback [https://forums.factorio.com/viewforum.php?f=233 on the forums]. | |||
A variable type which can have one of two values: <code>true</code> or <code>false</code>. Wikipedia has a comprehensive article on [[wikipedia:Boolean|Booleans]]. | A variable type which can have one of two values: <code>true</code> or <code>false</code>. Wikipedia has a comprehensive article on [[wikipedia:Boolean|Booleans]]. | ||
Revision as of 17:51, 16 August 2023
The prototype docs have moved to a new website with an improved format. This documentation page can now be found here: https://lua-api.factorio.com/latest/types/bool.html
This wiki page is no longer updated and will be removed at some point in the future, so please update your browser bookmarks or other links that sent you here. If you'd like to contribute to the new docs, you can leave your feedback on the forums.
A variable type which can have one of two values: true
or false
. Wikipedia has a comprehensive article on Booleans.
Advanced
Booleans used in prototypes can also be be defined by other variable types which are then coerced to boolean values by the game. This type coercion differs from the standard Lua truthy/falsy coercion.
It is recommended to only use true
and false
, not the options listed below.
Value | Factorio prototype loading type coercion to boolean |
Lua type coercion to boolean |
---|---|---|
"" |
false | true |
"true" |
true | true |
"false" |
false | true |
"0" |
false | true |
"<any number besides 0 (inside a string)>" |
true | true |
"<some random string>" |
not coerced, treated as a string | true |
0 |
false | true |
<any number besides 0> |
true | true |