mp.ui — 19 functions
All modal dialogs run on the GUI thread via BlockingQueuedConnection —
safe to call from the worker thread.
| Function | Returns | Description |
|---|---|---|
info(title, text) | void | Info message box |
warning(title, text) | void | Warning message box |
error(title, text) | void | Error message box |
question(title, text, ok?, cancel?) | bool | true if accepted; custom button labels |
choice(title, text, buttons[]) | int | Multi-button; returns 1-based index |
input_text(title, label, default?) | text, ok | Text input |
input_number(title, label, def?, min?, max?) | number, ok | Double input (2 decimals) |
input_int(title, label, def?, min?, max?) | int, ok | Integer input |
input_choice(title, label, items[], currentIdx?) | text, ok | Combo-box chooser |
open_file_dialog(title?, dir?, filter?) | string | Selected path or empty |
save_file_dialog(title?, dir?, filter?) | string | Selected path or empty |
get_theme() | string | "light" | "dark" | "telegram" | "telegram_dark" | "unknown" |
set_theme(name) | void | Switch theme immediately |
is_dark() | bool | Current theme is dark |
get_color(field) | string | Palette color as #RRGGBB |
set_popups(enabled) | void | false suppresses backend Info/Warning/Error modals during the script |
set_statusbar(label, value) | void | Hide standard checksum widgets; show "label: value" |
reset_statusbar() | void | Restore standard status bar |
output(text) | void | Append 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")