Weo Core
Weo
is the main module of the Weo framework. It provides essential utilities, services, and element management for building interactive UIs. All core functionality, services, and classes are accessible through this module.
Important
Weo.Alive
: A global flag indicating whether the Weo environment is running.- Type Definitions and Auto-Completion (VSCode): Weo uses EmmyLua for type checking and auto-completion. It should work automatically if you have EmmyLua installed. If you still want to edit or add types, you can check the
types/
folder. - Custom Print: Overrides the standard
print
to output viaconsole.writeln()
(for WLuaRT). - Element Parent Handling: If an element’s parent is the topmost ancestor (e.g., the main Window has no parent), the parent will be represented as the string
"root"
.
Element Parent Handling
Element.parent > AncestorElement or RenderSurface
RenderSurface.parent > Window
Window.parent > AncestorWindow or "root"
Functions
Weo.getAbsolutePositionAndSize()
Function
Weo.getAbsolutePositionAndSize(element, visited)
-
Returns table containing absolute position and size of an element relative to the root RenderSurface.
-
You can use readonly
(Element).absolute
property instead.
Parameters:
-
element
any- The element to get the absolute position and size for.
-
visited
table?- Optional table to track visited elements.
Returns:
{position : Vector2,size : Vector2}
table- Optional table to track visited elements.
Usage:
local T = Weo.getAbsolutePositionAndSize(element)
print(T.position.x, T.position.y, T.size.x, T.size.y)
Weo.watchTable()
Function
Weo.watchTable(tbl)
- Returns a proxy table that tracks changes in the original table.
Params:
tbl
table- Original table to be tracked.
Returns:
proxy
tableproxy.Changed
Signal
Proxy table with Change tracking.
Usage:
local myTable = { health = 100, mana = 50 }
local watchedTable = Weo.watchTable(myTable)
-- Connect a callback to track changes
watchedTable.Changed:Connect(function(key, oldValue, newValue)
print(string.format("Key '%s' changed from %s to %s", key, oldValue, newValue))
end)
Initialization
Weo automatically loads all core services, utilities, and elements for you.