Skip to main content

mp.ui — 19 functions

All modal dialogs run on the GUI thread via BlockingQueuedConnection — safe to call from the worker thread.

FunctionReturnsDescription
info(title, text)voidInfo message box
warning(title, text)voidWarning message box
error(title, text)voidError message box
question(title, text, ok?, cancel?)booltrue if accepted; custom button labels
choice(title, text, buttons[])intMulti-button; returns 1-based index
input_text(title, label, default?)text, okText input
input_number(title, label, def?, min?, max?)number, okDouble input (2 decimals)
input_int(title, label, def?, min?, max?)int, okInteger input
input_choice(title, label, items[], currentIdx?)text, okCombo-box chooser
open_file_dialog(title?, dir?, filter?)stringSelected path or empty
save_file_dialog(title?, dir?, filter?)stringSelected path or empty
get_theme()string"light" | "dark" | "telegram" | "telegram_dark" | "unknown"
set_theme(name)voidSwitch theme immediately
is_dark()boolCurrent theme is dark
get_color(field)stringPalette color as #RRGGBB
set_popups(enabled)voidfalse suppresses backend Info/Warning/Error modals during the script
set_statusbar(label, value)voidHide standard checksum widgets; show "label: value"
reset_statusbar()voidRestore standard status bar
output(text)voidAppend line to Script Console output panel

Quiet mode

set_popups(false) suppresses backend Info / Warning / Error modal boxes during the script — mp.backend.* ok / err still propagate, just no modal interruption. Auto-resets to true on scriptFinished, so a crash never leaves the GUI silent.

Status bar override

Used by checksum scripts:

mp.ui.set_statusbar("RL78 Block 0", "0xABCD") -- hides standard widgets
-- ...
mp.ui.reset_statusbar() -- restores standard widgets

Example

mp.ui.info("Title", "Hello")
local yes = mp.ui.question("Confirm", "Proceed?")
local sn, ok = mp.ui.input_text("Mass production", "Serial:", "SN001")
local path = mp.ui.open_file_dialog("Open", nil, "HEX (*.hex)")
mp.ui.set_theme("dark")