Page 1 of 1

Scripting - Strange behaviour of boolean parameters

Posted: Sun Dec 30, 2018 11:30 pm
by misohoza
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:

Code: Select all

parameter = "LayerSolo"
definition = this.parent:getParameterDefinition(parameter)

print(string.format("Name:    \t%s",
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")
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?

Re: Scripting - Strange behaviour of boolean parameters

Posted: Mon Jan 21, 2019 2:58 pm
by Gerrit Junge
Hi misohoza,
confirmed, I'm able to reproduce it here. Its now in our Defect-Tracking-System and listed as Bug-ID "HALLY-7731". I hope we can provide a fix for it soon.

Thanks for your report and please accept my apologies for any inconvenience caused.
Gerrit Junge