2.8 KiB
2.8 KiB
Basalt
This is the UI Manager and the starting point for your project. The following functions allow you to influence the default behavior of Basalt.
Before you can access Basalt, you need to add the following code on top of your file:
Usage
local basalt = require("basalt")
What this code does is it loads basalt into the project, and you can access it by using the variable defined as "basalt".
Functions
| Method | Returns | Description |
|---|---|---|
| basalt.create | table | Creates a new UI element |
| basalt.createFrame | table | |
| basalt.getElementManager | table | |
| basalt.getMainFrame | BaseFrame | |
| basalt.removeSchedule | - | |
| basalt.run | - | |
| basalt.scheduleUpdate | number | |
| basalt.setActiveFrame | - | |
| basalt.stop | - | |
| basalt.update | - |
basalt.create(type, id?)
Creates and returns a new UI element of the specified type.
Parameters
typestringThe type of element to create (e.g. "Button", "Label", "BaseFrame")id(optional)stringOptional unique identifier for the element
Returns
tableelementThe created element instance
Usage
local button = basalt.create("Button")
basalt.createFrame()
Creates and returns a new frame
Returns
tableBaseFrameThe created frame instance
Usage
local mainFrame = basalt.createFrame()
basalt.getElementManager()
Returns the element manager instance
Returns
tableElementManagerThe element manager
Usage
local manager = basalt.getElementManager()
basalt.getMainFrame()
Gets or creates the main frame
Returns
BaseFrametableThe main frame instance
Usage
local frame = basalt.getMainFrame()
basalt.removeSchedule(id)
Removes a scheduled update
Parameters
idnumberThe schedule ID to remove
Usage
basalt.removeSchedule(scheduleId)
basalt.run(isActive?)
Starts the Basalt runtime
Parameters
isActive(optional)booleanWhether to start active (default: true)
Usage
basalt.run()
basalt.run(false)
basalt.scheduleUpdate(func)
Schedules a function to be updated
Parameters
funcfunctionThe function to schedule
Returns
numberIdThe schedule ID
Usage
local id = basalt.scheduleUpdate(myFunction)
basalt.setActiveFrame(frame)
Sets the active frame
Parameters
frametableThe frame to set as active
Usage
basalt.setActiveFrame(myFrame)
basalt.stop()
Stops the Basalt runtime
Usage
basalt.stop()
basalt.update()
Updates all scheduled functions
Usage
basalt.update()