To boolean: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Grotfang
Specify datatype behaviour. Weird...
Line 16: Line 16:
}}|
}}|


function_description=Converts stuff.
function_description=Datatype behaviour:
* strings do this
* strings return false for anything except "true".
* ints do that.|
* integerss return true for anything except 0.
* floats return true for anything except 0.0 to (not quite) 1.0.
* locations return false.
* items return true.
* monsters return false.
* skills return true.
* effects return true.
* elements return false for [none] but true for everything else.|


needscode=yes|
needscode=yes|

Revision as of 00:34, 11 March 2010

needs(code_samples);

Function Syntax

boolean to_boolean( any anything)

  • anything is any data type that KoLmafia uses

Datatype behaviour:

  • strings return false for anything except "true".
  • integerss return true for anything except 0.
  • floats return true for anything except 0.0 to (not quite) 1.0.
  • locations return false.
  • items return true.
  • monsters return false.
  • skills return true.
  • effects return true.
  • elements return false for [none] but true for everything else.

    CLI Equivalent

    The CLI command

    See Also