UI Controllers

By setting the controller attribute on an XML frame, the engine will run the associated Lua script automatically when the UI frame is created and deliver events (such as OnEnable/OnDisable) to the Lua script. This makes it easier to customize UI frames in Lua and allows you to create reusable UI components with a combination of XML and Lua. Such Lua scripts also work in the UI previewer so you can iterate on UI related Lua code (like UI animations) much faster without the need to start the entire game.

Use Cases

Events sent to Lua

Relevant Lua APIs

Relevant XML Attributes

Example Map

https://platform.wildsky.dev/arcade/game/606 (Click “Source” to download)

Example