import{_ as a,a as t,b as r,ag as s}from"./chunks/framework.BcrMLAmg.js";const m=JSON.parse('{"title":"basalt","description":"","frontmatter":{},"headers":[],"relativePath":"references/main.md","filePath":"references/main.md","lastUpdated":1757840145000}'),l={name:"references/main.md"};function i(n,e,o,d,h,c){return r(),t("div",null,e[0]||(e[0]=[s('

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:What this code does is it loads basalt into the project, and you can access it by using the variable defined as "basalt".

Functions

MethodReturnsDescription
basalt.createtableCreates a new UI element
basalt.createFrameBaseFrameCreates a new BaseFrame
basalt.getElementManagertableReturns the element manager
basalt.getErrorManagertableReturns the error manager
basalt.getMainFrameBaseFrameGets or creates the main frame
basalt.setActiveFrame-Sets the active frame
basalt.getActiveFrameBaseFrameReturns the active frame
basalt.setFocus-Sets a frame as focused
basalt.getFocusBaseFrameReturns the focused frame
basalt.schedulethreadSchedules a function to run in a coroutine
basalt.removeSchedulebooleanRemoves a scheduled update
basalt.update-Runs basalt once
basalt.stop-Stops the Basalt runtime
basalt.run-Starts the Basalt runtime
basalt.getElementClasstableReturns an element class
basalt.getAPItableReturns a Plugin API
basalt.onEvent-Registers an event callback
basalt.removeEventbooleanRemoves an event callback
basalt.triggerEvent-Triggers a custom event

basalt.create(type, properties?)

Creates and returns a new UI element of the specified type.

Parameters

Returns

Usage

lua
local button = basalt.create("Button")

basalt.createFrame()

Creates and returns a new BaseFrame

Returns

basalt.getElementManager()

Returns the element manager instance

Returns

basalt.getErrorManager()

Returns the error manager instance

Returns

basalt.getMainFrame()

Gets or creates the main frame

Returns

basalt.setActiveFrame(frame, setActive?)

Sets the active frame

Parameters

basalt.getActiveFrame(t?)

Returns the active frame

Parameters

Returns

basalt.setFocus(frame)

Sets a frame as focused

Parameters

basalt.getFocus()

Returns the focused frame

Returns

basalt.schedule(func)

Schedules a function to run in a coroutine

Parameters

Returns

basalt.removeSchedule(func)

Removes a scheduled update

Parameters

Returns

basalt.update()

Runs basalt once, can be used to update the UI manually, but you have to feed it the events

basalt.stop()

Stops the Basalt runtime

basalt.run(isActive?)

Starts the Basalt runtime

Parameters

basalt.getElementClass(name)

Returns an element's class without creating a instance

Parameters

Returns

basalt.getAPI(name)

Returns a Plugin API

Parameters

Returns

basalt.onEvent(eventName, callback)

Registers a callback function for a specific event

Parameters

Usage

lua
basalt.onEvent("mouse_click", function(button, x, y) basalt.debug("Clicked at", x, y) end)

basalt.removeEvent(eventName, callback)

Removes a callback function for a specific event

Parameters

Returns

basalt.triggerEvent(eventName)

Triggers a custom event and calls all registered callbacks

Parameters

Usage

lua
basalt.triggerEvent("custom_event", "data1", "data2")
',97)]))}const b=a(l,[["render",i]]);export{m as __pageData,b as default};