1
0
Fork 0

Props: add defaultValue to getInt|Double Value

Simplify handling where the property value might be nil.
This commit is contained in:
James Turner 2022-03-24 11:40:14 +00:00
parent a395423f27
commit e945dafca3

View file

@ -58,12 +58,22 @@ var Node = {
return !!val;
},
getIntValue : func {
return math.round(me.getValue());
getIntValue : func (defaultValue = 0) {
var v = me.getValue();
if (!v) {
return defaultValue;
}
return math.round(v);
},
getDoubleValue : func {
return num(me.getValue());
getDoubleValue : func (defaultValue = 0.0) {
var v = me.getValue();
if (!v) {
return defaultValue;
}
return num(v);
},
remove : func {