Lua · Variables · Script UI
notepad
Open floating text windows: notes, logs, config editors.
A notepad is the same floating window the editor uses. The id is local to your script. To let the user save, define on_notepad_save(id, text); without it the Save button does nothing.
| Function | What it does |
|---|---|
notepad.open(id[, title][, text][, options]) | Opens (or brings back) a notepad. |
notepad.set_text(id, text) | Replaces the text and marks it saved. |
notepad.get_text(id) | The current text. Empty when not open. |
notepad.close(id) | Closes it. |
notepad.is_open(id) | True while open. |
#notepad.open
notepad.open(id[, title][, text][, options])Opens (or brings back) a notepad.
Arguments
idstringYour name for this notepad.
titlestringoptionalWindow title. Default the id.
textstringoptionalStarting text. Ignored when the window is already open with unsaved edits.
optionstableoptional{ code = true } for line numbers and Tab, { readonly = true } to block editing.Example
notepad.open("log", "Kill log", table.concat(lines, "\n"), { readonly = true })#notepad.set_text
notepad.set_text(id, text)Replaces the text and marks it saved.
#notepad.get_text
notepad.get_text(id)The current text. Empty when not open.
Returns
string
-
#notepad.close
notepad.close(id)Closes it.
#notepad.is_open
notepad.is_open(id)True while open.
Returns
boolean
-