Firetron's FormatBoolean

stable
By Firetron in Miscellaneous Published July 2020 👁 1,406 views 💬 1 comments

Description

Formats a boolean to a string so it can be logged.
HaasScript
--  ==========================================================================================================
--    Firetron's FormatBoolean
--
--    Formats a boolean to a string so it can be logged.
--
--    Discord:  @FiretronP75
--  ==========================================================================================================

--  ==============
--    Definition
--  ==============

DefineCommand('FormatBoolean', 'Formats a boolean to a string so it can be logged.')

--  ==============
--    Parameters
--  ==============

local input = DefineParameter(BooleanType, 'Input', 'The boolean to format', true, false)

--  ==========
--    Output
--  ==========

local output = ''

if input then
  output = 'true'
else
  output = 'false'
end

DefineOutput(StringType, output, 'Formatted Value')

1 Comment

Sign in to leave a comment.

F
Firetron almost 6 years ago

HaasScript errors if you try to log a boolean like Log('Is Open: '..isOpen)
You can do it by itself like Log(isOpen)
But then you have to put its label on an extra log output before it.
Is Open: true

is much nicer to see in the log than
Is Open:
true