Available for all global callbacks, or those at a widget/control level?
The only way I’ve found to communicate between the global script and widgets/controls is using the notify function. Everything I’ve tried to reference a custom global function in the widget/control script ends up with: No such property or function.
Some examples based on what I’ve figured out…
This is a button script (named ‘button2’):
if key == 'touch' and self.values[key] == true then
self.notify(self.parent, self.name, "Hello World")
This is in the global script:
function onReceiveNotify(source, string)
print(string.." from "..source)
Console message, after pressing button2.
You can use the notify function to go back the other way, passing parameters from a global function back to particular child controls.
When sticking within the global script, this part is within the onReceiveOSC callback:
local myNumber = 10
print("Start with: "..myNumber)
print("End with: "..multiplyByTen(myNumber))
This is the multiplyByTen function:
return (number * 10)
This is the console message: