I feel like I’m missing something obvious here. When I run a script like the following (a slightly modified example script):
-- Change colour of the control according to its value
-- The color of the control changes to orange when above
-- a threshold given by the Lua script
-- declare a global threshold variable
threshold = 96
print("Apply color script")
function applyColor (valueObject, value)
print("changing color")
local control = valueObject:getControl ()
if (value <= threshold) then
control:setColor (WHITE)
else
control:setColor (ORANGE)
end
end
I see a log message for my first global print statement (lua: Apply color script), but I don’t see a log item for the print statement in the applyColor callback. I’ve tried numerous copy-paste examples from the documentation that have print statements in callbacks, but I never seem to see any results.
I can confirm that there are no syntax errors, and the function is being called: with the example I posted, the color of the control does change when the value passes threshold, so it’s definitely being called.
I will add remark about that to the example scripts. It is for the second time that somebody was wasting time on that. And I will point that out in the Lua extension docs.