ui_windows.lua

main 49 lines · 1.3 KB Raw
Alex Alex Commit Client Upload Part 2 19/10/2026 00:06
1local context = G.botContext
2if type(context.UI) ~= "table" then
3 context.UI = {}
4end
5local UI = context.UI
6
7UI.EditorWindow = function(text, options, callback)
8 --[[
9 Available options:
10 title = text
11 description = text
12 multiline = true / false
13 width = number
14 validation = text (regex)
15 examples = {{name, text}, {name, text}}
16 ]]--
17 local window = modules.client_textedit.edit(text, options, callback)
18 window.botWidget = true
19 return window
20end
21
22UI.SinglelineEditorWindow = function(text, options, callback)
23 options = options or {}
24 options.multiline = false
25 return UI.EditorWindow(text, options, callback)
26end
27
28UI.MultilineEditorWindow = function(text, options, callback)
29 options = options or {}
30 options.multiline = true
31 return UI.EditorWindow(text, options, callback)
32end
33
34UI.ConfirmationWindow = function(title, question, callback)
35 local window = nil
36 local onConfirm = function()
37 window:destroy()
38 callback()
39 end
40 local closeWindow = function()
41 window:destroy()
42 end
43 window = context.displayGeneralBox(title, question, {
44 { text=tr('Yes'), callback=onConfirm },
45 { text=tr('No'), callback=closeWindow },
46 anchor=AnchorHorizontalCenter}, onConfirm, closeWindow)
47 window.botWidget = true
48 return window
49end
Top