Modules
A module is a script that can be loaded using require.
-- uikit is a module that can be used to build user interfaces. -- Here's how you can use it to display a button: uikit = require("uikit") local btn = uikit:createButton("this is a button") btn.onRelease = function() print("clicked") end
Modules follow these simple rules:
- When required, a module always returns a single table
- Each module uses its own sandboxed environment, meaning it can't access variables defined in the main script or other modules, even globals.
- When a module is required several times, the returned table is always the exact same reference
Currently, only modules packaged with the application can be used, they're all open-source and documented on this page.