ui/imguiUtils Reference
Module defined in `lua/common/extensions/ui/imguiUtils.lua`. Higher-level ImGui widget utilities - dropdowns, key-value tables, recursive tree displays, texture objects, and sampled float displays.
Module defined in lua/common/extensions/ui/imguiUtils.lua. Higher-level ImGui widget utilities - dropdowns, key-value tables, recursive tree displays, texture objects, and sampled float displays.
Exports
Functions
M.changeUIScale(uiscale)
Change the ImGui UI scale factor.
- Parameters:
uiscale- number - Scale multiplier
- Returns: boolean - true on success
M.drawCursorPos(posX, posY)
Draw content at a specific cursor position.
- Parameters:
posX- number - X cursor positionposY- number - Y cursor position
- Returns: boolean
M.texObj(path)
Create or retrieve a cached texture object from a file path.
- Parameters:
path- string - Image file path
- Returns:
table- Texture object
M.DropdownItem(label, icon, func, tooltip)
Create a dropdown menu item.
- Parameters:
label- string - Item labelicon- string|nil - Icon identifierfunc- function - Click callbacktooltip- string|nil - Hover tooltip
M.DropdownSelectableItem(label, active, func, tooltip)
Create a selectable dropdown item with active state.
- Parameters:
label- string - Item labelactive- boolean - Whether currently selectedfunc- function - Click callbacktooltip- string|nil - Hover tooltip
M.DropdownButton(label, size, items, icon, horizontal)
Create a dropdown button that opens a popup menu.
- Parameters:
label- string - Button labelsize- ImVec2 - Button sizeitems- table - Array of DropdownItem tablesicon- string|nil - Button iconhorizontal- boolean|nil - Horizontal layout
- Returns: boolean - true if an item was clicked
M.DropdownSelectable(label, items, icon, iconSize, popupWidth, onChangeFunc, tooltip, itemsRMB)
Create a selectable dropdown with icon and popup.
- Parameters:
label- string - Display labelitems- table - Selectable itemsicon- string|nil - IconiconSize- number|nil - Icon sizepopupWidth- number|nil - Popup widthonChangeFunc- function|nil - Selection change callbacktooltip- string|nil - TooltipitemsRMB- table|nil - Right-click menu items
- Returns: boolean
M.DropdownSelect(label, size, selectedItem, items, horizontal, excludeCurrent)
Dropdown select widget (combo box replacement).
- Parameters:
label- string - Labelsize- ImVec2 - Widget sizeselectedItem- string - Currently selected itemitems- table - Available itemshorizontal- boolean|nil - Horizontal layoutexcludeCurrent- boolean|nil - Hide current selection from list
- Returns: boolean
M.IsWindowHovered(windowPos, windowSize)
Check if an ImGui window at the given position/size is hovered.
- Parameters:
windowPos- ImVec2 - Window positionwindowSize- ImVec2 - Window size
- Returns: boolean
M.displayKeyValues(tbl)
Display a Lua table as key/value pairs in ImGui.
- Parameters:
tbl- table - Data to display
M.CreateKeyValApp(window, section, tbl, callback)
Create a simple key/value display app from a Lua table.
- Parameters:
window- string - Window namesection- string - Section nametbl- table - Data tablecallback- function|nil - Edit callback
M.keyValueTable(data, fullpath, highlightCallback, itemCallback)
Render a key-value table widget.
- Parameters:
data- table - Data to displayfullpath- string - Current path prefixhighlightCallback- function|nil - Row highlight callbackitemCallback- function|nil - Item interaction callback
M.addRecursiveTreeTable(data, fullpath, noColumns, highlightCallback, itemCallback)
Render a recursive tree table widget for nested data.
- Parameters:
data- table - Nested data to displayfullpath- string - Path prefixnoColumns- boolean|nil - Disable column headershighlightCallback- function|nil - Highlight callbackitemCallback- function|nil - Item callback
M.cell(a, b)
Render a two-column table cell.
- Parameters:
a- string - Left column valueb- string - Right column value
M.CreateSampleFloatDisplay(sampleTimeInSeconds, startingValue, precision)
Create a sampled float display object that averages values over time.
- Parameters:
sampleTimeInSeconds- number - Sample window durationstartingValue- number - Initial display valueprecision- number|nil - Decimal precision
- Returns: table - Display object with
:update(value)and:display()methods
M.SampleFloatDisplay(id, value, sampleTimeInSeconds, precision)
Stateless sampled float display - auto-creates/updates a display by ID.
- Parameters:
id- string - Unique identifiervalue- number - Current valuesampleTimeInSeconds- number - Sample windowprecision- number|nil - Decimal precision
Variables
M.sampleFloatDisplayState
- Type: table
- Description: Internal state storage for
SampleFloatDisplayinstances (keyed by ID)
Internal Notes
- Uses FFI for ImGui pointer types
newValueSamplercreates time-windowed value averaging objectspointToLinehelper computes point-to-line distance for UI interaction- Sorted key iteration via
getTableKeysSorted - Recursive tree rendering handles arbitrary nesting depth
ui/imgui Reference
Module defined in `lua/common/extensions/ui/imgui.lua`. ImGui context manager - initializes and maintains the Lua-side ImGui context linked to the C++ engine context.
ui/imguiWire Reference
Module defined in `lua/common/extensions/ui/imguiWire.lua`. ImGui wire protocol - serializes ImGui draw commands into a buffer for remote/deferred execution. Enables ImGui rendering across process bou