Recently I’ve noticed some strange behaviour of boolean parameters.
I’m using Halion 6.2.10 version.
Parameter definition of boolean parameters returns true/false for default, but numbers 0 or 1 for min and max values. This can cause errors when calling getDisplayString and using the min/max values from parameter definition.
GetParameter function returns boolean, which is expected.
SetParameter: “true” sets a boolean parameter to “On”, but you can use anything except “true” (false, nil, any string or number) to set a boolean parameter to “Off”.
It should be fairly easy to reproduce:
parameter = "LayerSolo"
definition = this.parent:getParameterDefinition(parameter)
print(string.format("Name: \t%s", definition.name))
print(string.format("Type: \t\t%s", definition.type))
print(string.format("Default: \t\t%s", definition.default))
print(string.format("Min: \t\t%s", definition.min))
print(string.format("Max: \t\t%s", definition.max))
print(string.format("Value: \t\t%s\n", this.parent:getParameter(parameter)))
print(string.format("getParameter returns:\t\t %s\n", type(this.parent:getParameter(parameter))))
print("Set Parameter with boolean (true)")
this.parent:setParameter(parameter, true)
print(string.format("Value: \t\t%s\n", this.parent:getParameter(parameter)))
messageBox("Solo button On?")
--anything except "true" sets a boolean parameter to "Off"
print("Set Parameter with string instead of boolean")
this.parent:setParameter(parameter,"blabla")
print(string.format("Value: \t\t%s\n", this.parent:getParameter(parameter)))
--print(definition:getDisplayString(definition.min)) --error
Sure, there are ways how to work around this, but still I think this is not correct behaviour.
Can anyone confirm?