Types/bool

From Official Factorio Wiki
Revision as of 13:04, 19 January 2022 by Bilka (talk | contribs) (Documented type coercion)
Jump to navigation Jump to search

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 coercion
to boolean 
Lua 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