OnEvent function since v0.1 ¶
Given an event name, returns a special key which connects to events of that name. It should be used with a handler callback, which may accept arguments from the event.
(eventName: string) -> SpecialKey
Parameters¶
eventName
- the name of the event to connect to
Returns¶
A special key which runs at the observer
stage. When applied to an instance,
it connects to the event on the instance of the given name. The handler is run
with the event's arguments after every firing.
Example Usage¶
New "TextButton" {
[OnEvent "Activated"] = function(...)
print("The button was clicked! Arguments:", ...)
end
}