This commit is contained in:
Robert Jelic
2025-02-09 17:51:45 +01:00
parent 48dd66212e
commit fb8844108e

View File

@@ -2,11 +2,6 @@
-- This is the main entry point for the Basalt UI Framework. -- This is the main entry point for the Basalt UI Framework.
-- It provides functions for creating and managing UI elements and handling events. -- It provides functions for creating and managing UI elements and handling events.
-- @module basalt -- @module basalt
-- @author NyoriE
-- @license MIT
-- @copyright 2025
-- @release 2.0
-- @see elementManager
-- @usage -- @usage
-- local basalt = require("basalt") -- local basalt = require("basalt")
-- local mainFrame = basalt.createFrame() -- local mainFrame = basalt.createFrame()
@@ -35,16 +30,11 @@ basalt.LOGGER = require("log")
local mainFrame = nil local mainFrame = nil
local updaterActive = false local updaterActive = false
--- Creates a new UI element --- Creates and returns a new UI element of the specified type
-- Creates and returns a new UI element of the specified type --- @param type string The type of element to create (e.g. "Button", "Label", "BaseFrame")
-- @function create --- @param id? string Optional unique identifier for the element
-- @param type string The type of element to create (e.g. "Button", "Label", "BaseFrame") --- @return table element The created element instance
-- @param[opt] id string Optional unique identifier for the element --- @usage local button = basalt.create("Button")
-- @treturn table The created element instance
-- @see elementManager.getElement
-- @usage
-- local button = basalt.create("Button", "myButton")
-- button:setPosition(5, 5)
function basalt.create(type, id) function basalt.create(type, id)
if(id==nil)then id = elementManager.generateId() end if(id==nil)then id = elementManager.generateId() end
local element = elementManager.getElement(type).new(id, basalt) local element = elementManager.getElement(type).new(id, basalt)
@@ -56,9 +46,8 @@ function basalt.create(type, id)
end end
--- Creates and returns a new frame --- Creates and returns a new frame
-- @function createFrame --- @return table BaseFrame The created frame instance
-- @return table The created frame instance --- @usage local mainFrame = basalt.createFrame()
-- @usage local mainFrame = basalt.createFrame()
function basalt.createFrame() function basalt.createFrame()
local frame = basalt.create("BaseFrame") local frame = basalt.create("BaseFrame")
mainFrame = frame mainFrame = frame