Events are actions detected by HTML and the browser. JavaScript can respond to these events, and this page uses a bridge to let Luau respond to them too.
JavaScript event example:
document.getElementById("clickButton").addEventListener("click", function() {
document.getElementById("eventOutput").textContent = "You clicked!";
});
Luau event-handling example:
local eventName = getEventName()
local eventValue = getEventValue()
if eventName == "click" then
setEventOutput("You clicked!")
end
The browser detects the event in JavaScript and passes its name and value to Luau using bridge functions.
Interact with the examples above to trigger your Luau code. Edit this code to change how events are handled, then click Run Luau to activate your changes.