Files
Basalt2/index.md
2025-02-09 18:10:08 +00:00

8.7 KiB

<html> <head> </head>

Basalt2

Contents

Modules

  • basalt

Module basalt

Basalt UI Framework main module.

This is the main entry point for the Basalt UI Framework. It provides functions for creating and managing UI elements and handling events.

Usage:

    local basalt = require("basalt")
    local mainFrame = basalt.createFrame()
    mainFrame:show()
    basalt.run()
    

Class Basalt

basalt:create (type, id) Creates and returns a new UI element of the specified type
basalt:createFrame () Creates and returns a new frame
basalt:getElementManager () Returns the element manager instance
basalt:getMainFrame () Gets or creates the main frame
basalt:setActiveFrame (frame) Sets the active frame
basalt:scheduleUpdate (func) Schedules a function to be updated
basalt:removeSchedule (id) Removes a scheduled update
basalt.updateEvent (event, ...) Internal event handler
basalt.renderFrames () Internal render function
basalt:update () Updates all scheduled functions
basalt:stop () Stops the Basalt runtime
basalt:run (isActive) Starts the Basalt runtime


<h2 class="section-header has-description"><a name="Class_Basalt"></a>Class Basalt </h2>

      <div class="section-description">
      The main Basalt instance

Contains all core functionality and management functions

basalt:create (type, id)
Creates and returns a new UI element of the specified type

<h3>Parameters:</h3>
<ul>
    <li><span class="parameter">type</span>
     string The type of element to create (e.g. "Button", "Label", "BaseFrame")
    </li>
    <li><span class="parameter">id</span>
    ? string Optional unique identifier for the element
    </li>
</ul>

<h3>Returns:</h3>
<ol>

    table element The created element instance
</ol>



<h3>Usage:</h3>
<ul>
    <pre class="example"><span class="keyword">local</span> button = basalt.<span class="function-name">create</span>(<span class="string">"Button"</span>)</pre>
</ul>
basalt:createFrame ()
Creates and returns a new frame
<h3>Returns:</h3>
<ol>

    table BaseFrame The created frame instance
</ol>



<h3>Usage:</h3>
<ul>
    <pre class="example"><span class="keyword">local</span> mainFrame = basalt.<span class="function-name">createFrame</span>()</pre>
</ul>
basalt:getElementManager ()
Returns the element manager instance
<h3>Returns:</h3>
<ol>

    table ElementManager The element manager
</ol>



<h3>Usage:</h3>
<ul>
    <pre class="example"><span class="keyword">local</span> manager = basalt.<span class="function-name">getElementManager</span>()</pre>
</ul>
basalt:getMainFrame ()
Gets or creates the main frame
<h3>Returns:</h3>
<ol>

    BaseFrame table The main frame instance
</ol>



<h3>Usage:</h3>
<ul>
    <pre class="example"><span class="keyword">local</span> frame = basalt.<span class="function-name">getMainFrame</span>()</pre>
</ul>
basalt:setActiveFrame (frame)
Sets the active frame
<h3>Parameters:</h3>
<ul>
    <li><span class="parameter">frame</span>
     table The frame to set as active
    </li>
</ul>




<h3>Usage:</h3>
<ul>
    <pre class="example">basalt.<span class="function-name">setActiveFrame</span>(myFrame)</pre>
</ul>
basalt:scheduleUpdate (func)
Schedules a function to be updated
<h3>Parameters:</h3>
<ul>
    <li><span class="parameter">func</span>
     function The function to schedule
    </li>
</ul>

<h3>Returns:</h3>
<ol>

    number Id The schedule ID
</ol>



<h3>Usage:</h3>
<ul>
    <pre class="example"><span class="keyword">local</span> id = basalt.<span class="function-name">scheduleUpdate</span>(myFunction)</pre>
</ul>
basalt:removeSchedule (id)
Removes a scheduled update
<h3>Parameters:</h3>
<ul>
    <li><span class="parameter">id</span>
     number The schedule ID to remove
    </li>
</ul>




<h3>Usage:</h3>
<ul>
    <pre class="example">basalt.<span class="function-name">removeSchedule</span>(scheduleId)</pre>
</ul>
basalt.updateEvent (event, ...)
Internal event handler
<h3>Parameters:</h3>
<ul>
    <li><span class="parameter">event</span>



    </li>
    <li><span class="parameter">...</span>



    </li>
</ul>
basalt.renderFrames ()
Internal render function
basalt:update ()
Updates all scheduled functions
<h3>Usage:</h3>
<ul>
    <pre class="example">basalt.<span class="function-name">update</span>()</pre>
</ul>
basalt:stop ()
Stops the Basalt runtime
<h3>Usage:</h3>
<ul>
    <pre class="example">basalt.<span class="function-name">stop</span>()</pre>
</ul>
basalt:run (isActive)
Starts the Basalt runtime
<h3>Parameters:</h3>
<ul>
    <li><span class="parameter">isActive</span>
     boolean Whether to start active (default: true)
    </li>
</ul>




<h3>Usage:</h3>
<ul>
    <li><pre class="example">basalt.<span class="function-name">run</span>()</pre></li>
    <li><pre class="example">basalt.<span class="function-name">run</span>(<span class="keyword">false</span>)</pre></li>
</ul>
generated by LDoc 1.5.0 Last updated 2025-02-09 18:10:07
</html>