Skip to content

ui Lua Interface


sleep

Sleep thread

Arguments:
number ms Milliseconds to sleep

Example

ui:.sleep(ms)


Begin

Push a new Dear ImGui window to add widgets to.

Arguments:
string wname The window name is used as a unique identifier to preserve window information across frames
string sentry (Optional) Shared memory entry to sync with window open status
number flags (Optional) ImGuiWindowFlags to send to ImGui

Example

ui:.Begin(wname,sentry,flags)


Image

Push an Image widget to the current context

Arguments:
string name The widget name is used as a unique identifier
number[] imageSizeVec (Optional) Image size (Use this or im_vec as size)

Example

ui:.Image(name,imageSizeVec)


FaIconButton

Push an FaIconButton widget to the current context

Arguments:
string key The font awesome corresponding string is used as a unique identifier and to load the icon
number[] imageSizeVec (Optional) Image size
string tooltip (Optional) Tooltip to show for button

Example

ui:.FaIconButton(key,imageSizeVec,tooltip)


BeginMenu

Push a Menu widget to the current context

Arguments:
string label Label to identify the menu
boolean enabled (Optional) Initial menu state

Example

ui:.BeginMenu(label,enabled)


Push a MenuItem widget to the current menu context

Arguments:
string label Label to identify the menu item
string shortcut (Optional) Shortcut for menu item
string selected_entry (Optional) Current parent menu selected entry (Selects if its the current one)

Example

ui:.MenuItem(label,shortcut,selected_entry)


InputText

Push an InputText widget to the current context

Arguments:
string label Label to identify the input text
string bufname (Optional) Shared memory entry to sync with InputText text buffer (Max. 1024)
number flags (Optional) ImGuiInputTextFlags to send to ImGui

Example

ui:.InputText(label,bufname,flags)


InputTextLocal

Push an InputTextLocal widget to the current context, this will return its current text

Arguments:
string label Label to identify the input text
string default_value Default value for textbox
number string_size Size for the string
number flags (Optional) ImGuiInputTextFlags to send to ImGui
Returns:
string val InputText value

Example

val = ui:.InputTextLocal(label,default_value,string_size,flags)


SameLine

Force next item to be on the same line

Arguments:

Example

ui:.SameLine()


Selectable

Push a Selectable widget to the current menu context

Arguments:
string label Label to identify the item
string selected_entry (Optional) Current parent menu selected entry (Selects if its the current one)
number flags (Optional) ImGuiSelectableFlags to send to ImGui

Example

ui:.Selectable(label,selected_entry,flags)


BeginTable

Start drawing a Table to the current context

Arguments:
string label Label to identify the item
number column Column to draw to
number flags (Optional) ImGuiTableFlags to send to ImGui

Example

ui:.BeginTable(label,column,flags)


TableNextRow

Start drawing next row on a Table

Arguments:
number flags (Optional) ImGuiTableFlags to send to ImGui
number min_height (Optional) Minimum row height

Example

ui:.TableNextRow(flags,min_height)


TableSetupColumn

Start drawing column on a Table

Arguments:
string label Label to identify the item
number flags (Optional) ImGuiTableFlags to send to ImGui
number width (Optional) Column Width

Example

ui:.TableSetupColumn(label,flags,width)


CollapsingHeader

Start drawing a CollapsingHeader to the current context

Arguments:
string label Label to identify the item
number flags (Optional) ImGuiTableFlags to send to ImGui

Example

ui:.CollapsingHeader(label,flags)


DrawRect

Push a Rectangle to the WindowDrawList

Arguments:
number[] startPos Rectangle start position
number[] stopPos Rectangle end position
number[] cvColor (Optional) Rectangle color. (Array with RGBA) Default 1.0,1.0,1.0,1.0
number thickness (Optional) Rectangle thickness. Default 1.0

Example

ui:.DrawRect(startPos,stopPos,cvColor,thickness)


DrawCircle

Push a Circle to the WindowDrawList

Arguments:
number[] startPos Circle center position
number radius (Optional) Circle radius. Default 1.0
number[] cvColor (Optional) Circle color. (Array with RGBA) Default 1.0,1.0,1.0,1.0
number numSegments (Optional) Circle number of segments. Default 12
number thickness (Optional) Circle thickness. Default 1.0

Example

ui:.DrawCircle(startPos,radius,cvColor,numSegments,thickness)


DrawConvexPolyFilled

Push a Convex polygon to the WindowDrawList

Arguments:
number[][] pointVec Points List.
number[] color (Optional) ConvexPoly color. (Array with RGBA) Default 1.0,1.0,1.0,1.0

Example

ui:.DrawConvexPolyFilled(pointVec,color)


DrawPolyLine

Push a Poly Line to the WindowDrawList

Arguments:
number[][] pointVec Points List.
number[] color (Optional) PolyLine color. (Array with RGBA) Default 1.0,1.0,1.0,1.0
number flags (Optional) ImGuiFlags to send to ImGui
number thickness (Optional) PolyLine thickness. Default 1.0

Example

ui:.DrawPolyLine(pointVec,color,flags,thickness)


PlotLines

Plot a line from a float vector

Arguments:
string label Label to identify the item
number[] values Values list.
string overlay (Optional)
number fMin (Optional) Minimum value for plot
number fMax (Optional) Maximum value for plot
number[] graphSize (Optional) Plot size. Vector must be size 2

Example

ui:.PlotLines(label,values,overlay,fMin,fMax,graphSize)


initialize

Initialize ImGui system

Arguments:

Example

ui:.initialize()


render

Perform a render iteration on ImGui

Arguments:

Example

ui:.render()


shutdown

Shutdown ImGui system

Arguments:

Example

ui:.shutdown()


SliderFloat

Push a SliderFloat to the WindowDrawList

Arguments:
string label Label to identify the item
string entry Shared memory entry to sync with value
number vMin Slider minimum value
number vMax Slider maximum value
number vDefault Slider default value

Example

ui:.SliderFloat(label,entry,vMin,vMax,vDefault)


SliderInt

Push a SliderInt to the WindowDrawList

Arguments:
string label Label to identify the item
string entry Shared memory entry to sync with value
number vMin Slider minimum value
number vMax Slider maximum value
number vDefault Slider default value

Example

ui:.SliderInt(label,entry,vMin,vMax,vDefault)


loadShmFromConfig

Load the shared memory dictionary from a given json file

Arguments:
string configPath Path to json file with configuration

Example

ui:.loadShmFromConfig(configPath)


getUIState

Get the current UI state stored on shared memory

Arguments:

Returns:
table ui_state Map object with shm, colors and styles entries

Example

ui_state = ui:.getUIState()


loadUIState

Load the UI state from a given json file with shm,styles and colors properties

Arguments:
string configPath Path to json file with configuration

Example

ui:.loadUIState(configPath)


saveUIState

Save the UI state to a given json file with shm,styles and colors properties

Arguments:
string configPath Path to save json file with configuration

Example

ui:.saveUIState(configPath)


getSharedMemory

Get the shared memory object

Arguments:

Returns:
table shm Table with shared memory object (Readonly, use SetSharedMemoryEntry to save)

Example

shm = ui:.getSharedMemory()


getSharedMemoryEntry

Get the shared memory entry for a given property

Arguments:
string entry Entry property name to get
Returns:
any entry Shared memory object value

Example

entry = ui:.getSharedMemoryEntry(entry)


SetSharedMemoryEntry

Set the shared memory entry for a given property

Arguments:
string entry Entry property name to set
any obj Value to set (any Lua object)

Example

ui:.SetSharedMemoryEntry(entry,obj)


TableSetBgColor

Set the background color for the current table

Arguments:
number flag ImGuiTableBgTarget property for ImGui
number[] color Array to set color (must have 4 numbers)

Example

ui:.TableSetBgColor(flag,color)


PushStyleColor

Set the background color for the current table

Arguments:
number idx ImGuiCol identifier property
number[] color Array to set color (must have 4 numbers)

Example

ui:.PushStyleColor(idx,color)


Checkbox

Push a Checkbox to the WindowDrawList

Arguments:
string label Label to identify the item
string entry Shared memory entry to sync with value
boolean vDefault Checkbox default value

Example

ui:.Checkbox(label,entry,vDefault)


ColorEdit4

Push a ColorEdit4 color picker to the WindowDrawList

Arguments:
string label Label to identify the item
string entry Shared memory entry to sync with value
number flags ImGuiColorEditFlags identifier property

Example

ui:.ColorEdit4(label,entry,flags)


GetRelativeMousePos

Get mouse position relative to current ImGui context

Arguments:

Returns:
table pos Mouse position point (1:x, 2:y)

Example

pos = ui:.GetRelativeMousePos()


GetFrameRelativeMousePos

Get mouse position relative to current instance framebuffer

Arguments:
string name Instance name to get frame size
Returns:
table pos Mouse position point (1:x, 2:y)

Example

pos = ui:.GetFrameRelativeMousePos(name)


SetTooltip

Set the tooltip for the previous item

Arguments:
string text Tolltip text to show

Example

ui:.SetTooltip(text)


BeginCombo

Begin a combobox widget

Arguments:
string label Label to identify the item
string preview_value Combobox initial value
number flags ImGuiComboFlags

Example

ui:.BeginCombo(label,preview_value,flags)


BeginPopupContextItem

Begin a context item

Arguments:
string label Label to identify the context menu item

Example

ui:.BeginPopupContextItem(label)


EndPopup

End a context item

Arguments:

Example

ui:.EndPopup()


TableSetColumnIndex

TableNextRow() to create a new row, and TableSetColumnIndex() to select the column.

Arguments:
number col Column index

Example

ui:.TableSetColumnIndex(col)


SetNextWindowSize

Set next window size.

Arguments:
number[] sz Window size
number cond ImGuiCond condition

Example

ui:.SetNextWindowSize(sz,cond)


SetCursorPos

Set next cursor pos.

Arguments:
number[] sz Window size
number cond ImGuiCond condition

Example

ui:.SetCursorPos(sz,cond)


Button

Begin a button widget

Arguments:
string label Label to identify the item
number[] sz Button size

Example

ui:.Button(label,sz)


SmallButton

Begin a small fixed size button widget

Arguments:
string label Label to identify the item

Example

ui:.SmallButton(label)


GetKeyIndex

Get the index of a ImGuiKey value

Arguments:
number key ImGuiKey value
Returns:
number index Key index

Example

index = ui:.GetKeyIndex(key)


IsKeyPressed

Check if key is pressed

Arguments:
number user_key_index ImGuiKey index
boolean rpt Repeat
Returns:
boolean is_pressed Key is pressed

Example

is_pressed = ui:.IsKeyPressed(user_key_index,rpt)


SetMouseCursor

Set mouse cursor type

Arguments:
number cursor_type ImGuiMouseCursor value

Example

ui:.SetMouseCursor(cursor_type)


IsMouseClicked

Check if mouse button is clicked

Arguments:
number button ImGuiMouseButton index
boolean rpt Repeat
Returns:
boolean is_clicked Mouse is clicked

Example

is_clicked = ui:.IsMouseClicked(button,rpt)


IsMouseDoubleClicked

Check if mouse button is double clicked

Arguments:
number button ImGuiMouseButton index
Returns:
boolean is_dclicked Mouse is double clicked

Example

is_dclicked = ui:.IsMouseDoubleClicked(button)


IsMouseReleased

Check if mouse button is released

Arguments:
number button ImGuiMouseButton index
Returns:
boolean is_released Mouse is released

Example

is_released = ui:.IsMouseReleased(button)


ScaleAllSizes

Scale Application UI

Arguments:
number scale_factor Scale factor for UI

Example

ui:.ScaleAllSizes(scale_factor)


TreeNode

Add a TreeNode widget

Arguments:
string label Label to identify the item

Example

ui:.TreeNode(label)


Text

Add a Text widget

Arguments:
string text Text to show

Example

ui:.Text(text)


GetTextSize

Get the size a label will occupy

Arguments:
string text Text to calc
Returns:
number sz Size for the specified text

Example

sz = ui:.GetTextSize(text)


TextWrapped

Add a TextWrapped widget

Arguments:
string text Text to show

Example

ui:.TextWrapped(text)


KeyCtrl

Keyboard modifier pressed: Ctrl

Arguments:

Returns:
boolean pressed Key pressed

Example

pressed = ui:.KeyCtrl()


KeyAlt

Keyboard modifier pressed: Alt

Arguments:

Returns:
boolean pressed Key pressed

Example

pressed = ui:.KeyAlt()


KeyShift

Keyboard modifier pressed: Shift

Arguments:

Returns:
boolean pressed Key pressed

Example

pressed = ui:.KeyShift()


KeysDown

Returns a list with the current keys down

Arguments:

Returns:
table keys Table with keys down

Example

keys = ui:.KeysDown()


PushID

Set an id for the next item

Arguments:
number id ID

Example

ui:.PushID(id)


BeginChild

BeginChild

Arguments:

Example

ui:.BeginChild()


EndChild

EndChild

Arguments:

Example

ui:.EndChild()


SetNextItemWidth

Set next item width

Arguments:
number Next item width

Example

ui:.SetNextItemWidth(Next)


GetWindowContentRegionWidth

GetWindowContentRegionWidth

Arguments:

Example

ui:.GetWindowContentRegionWidth()


Selectable2

Begin a fixed Selectable widget

Arguments:
string label Label to identify the item
boolean selected Is the item selected
number flags ImGuiComboFlags

Example

ui:.Selectable2(label,selected,flags)


ShowStyleEditor

Show the ImGui style editor widget

Arguments:

Example

ui:.ShowStyleEditor()


EndCombo

End combobox

Arguments:

Example

ui:.EndCombo()


GetItemRectMin

GetItemRectMin

Arguments:

Returns:
table Minimum rectangle

Example

Minimum = ui:.GetItemRectMin()


GetItemRectMax

GetItemRectMax

Arguments:

Returns:
table Maximum rectangle

Example

Maximum = ui:.GetItemRectMax()


GetItemRectSize

GetItemRectSize

Arguments:

Returns:
table Item size rectangle

Example

Item = ui:.GetItemRectSize()


TableNextColumn

Skip to next column in a table

Arguments:

Returns:
boolean ok Ok

Example

ok = ui:.TableNextColumn()


PopStyleColor

Pop style color after callin PushStyleColor

Arguments:

Example

ui:.PopStyleColor()


EndTable

End a table

Arguments:

Example

ui:.EndTable()


TableHeadersRow

Set HeadersRow in a table

Arguments:

Example

ui:.TableHeadersRow()


EndMenu

End a menu

Arguments:

Example

ui:.EndMenu()


TreePop

TreePop

Arguments:

Example

ui:.TreePop()


End

End

Arguments:

Example

ui:.End()


IsMousePosValid

Check if mouse position value is valid

Arguments:

Returns:
boolean valid Valid mouse position

Example

valid = ui:.IsMousePosValid()


GetMousePos

Get current mouse position

Arguments:

Returns:
table pos Mouse position vector

Example

pos = ui:.GetMousePos()


IsItemHovered

Check if last called item is hovered

Arguments:

Returns:
boolean hovered Item is hovered

Example

hovered = ui:.IsItemHovered()


BeginMainMenuBar

BeginMainMenuBar

Arguments:

Example

ui:.BeginMainMenuBar()


EndMainMenuBar

EndMainMenuBar

Arguments:

Example

ui:.EndMainMenuBar()


GetWindowWidth

Get current window width

Arguments:

Returns:
number Window width

Example

Window = ui:.GetWindowWidth()


GetWindowHeight

Get current window height

Arguments:

Returns:
number Height height

Example

Height = ui:.GetWindowHeight()


GetContentRegionAvail

Get available content region

Arguments:

Returns:
table sz Content region size

Example

sz = ui:.GetContentRegionAvail()


PopID

Called after PushID

Arguments:

Example

ui:.PopID()


FileDialog_OpenDialog

Open a new file dialog widget

Arguments:
string key Widget key
string title File dialog window title
string path File dialog starting path
string filters (Optional) File dialog directory filters

Example

ui:.FileDialog_OpenDialog(key,title,path,filters)


FileDialog_Display

Display a file dialog widget

Arguments:
string key Widget key
Returns:
boolean is_open File dialog open

Example

is_open = ui:.FileDialog_Display(key)


FileDialog_IsOk

Check if file dialog OK button was pressed

Arguments:

Returns:
boolean ok_pressed OK button pressed

Example

ok_pressed = ui:.FileDialog_IsOk()


FileDialog_GetFilePathName

Get choosen file path

Arguments:

Returns:
string file_path Choosen file path

Example

file_path = ui:.FileDialog_GetFilePathName()


FileDialog_GetCurrentPath

Get current file path

Arguments:

Returns:
string file_path Current file path

Example

file_path = ui:.FileDialog_GetCurrentPath()


FileDialog_Close

Close a file dialog widget

Arguments:

Example

ui:.FileDialog_Close()


showDefaultInputConfigMenu

Show full Input plugin configuration widget

Arguments:
inputmanaged ptr Reference to input plugin
string[] sections Sections to show

Example

ui:.showDefaultInputConfigMenu(ptr,sections)


showConfigWidget

Show a widget containing dynamically loaded properties for a plugin configuration (BETA)

Arguments:
any ptr Reference to input plugin
string name Widget name

Example

ui:.showConfigWidget(ptr,name)


showInstanceConfigWidget

Show a widget containing dynamically loaded properties for an instance configuration (BETA)

Arguments:
string name Instance name
table config Configuration table (get with rt:getGlobalConfig())

Example

ui:.showInstanceConfigWidget(name,config)


SetupCameraEditor

Setup camera editor widget, preload camera values on the widget

Arguments:
string camera_id Id for the system camera to edit

Example

ui:.SetupCameraEditor(camera_id)


ShowCameraEditor

Show camera editor widget

Arguments:
string camera_id Id for the system camera to edit

Example

ui:.ShowCameraEditor(camera_id)


ShowCameraManager

Show camera manager widget

Arguments:

Example

ui:.ShowCameraManager()


ShowCameraCredentialsRequest

Show camera credentials request window

Arguments:
table camera Camera object to set credentials

Example

ui:.ShowCameraCredentialsRequest(camera)


ShowProfilerWidget

Show timimngs profiler widget

Arguments:

Example

ui:.ShowProfilerWidget()


drawDebugLogWindow

Show logs list widget

Arguments:

Example

ui:.drawDebugLogWindow()


drawMainMenu

Draw Main Menu

Arguments:

Example

ui:.drawMainMenu()


drawInputBar

Draw input control bar

Arguments:

Example

ui:.drawInputBar()


drawInstanceWindows

Draw input window

Arguments:

Example

ui:.drawInstanceWindows()


ShowWelcomeWindow

Show welcome window from docs/md/index.md markdown file

Arguments:

Example

ui:.ShowWelcomeWindow()


showMarkdown

Show markdown content from a content string

Arguments:
string markdown_content String with text that represents the markdown to show

Example

ui:.showMarkdown(markdown_content)


showMarkdownFile

Show markdown content from a file

Arguments:
string markdown_file Path to markdown file

Example

ui:.showMarkdownFile(markdown_file)


GetSolutionInfoPath

Show solution md info file path on solution_path/docs/index.md (Empty if not existent)

Arguments:
string solution_name Solution name to show info from
number solution_id Solution id to show info from
Returns:
string file_path Absolute path to solution md info file

Example

file_path = ui:.GetSolutionInfoPath(solution_name,solution_id)


ShowWelcomeWindow

Show welcome window from docs/md/index.md markdown file

Arguments:

Example

ui:.ShowWelcomeWindow()


drawSelectedInstanceMenus

Draw selected Instance menus

Arguments:

Example

ui:.drawSelectedInstanceMenus()


renderModulesUI

Call onRenderUI function on each module UI script file (lua/ui/[module_name].lua by default)

Arguments:

Example

ui:.renderModulesUI()