forked from Epix-Incorporated/Adonis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTerminal.luau
More file actions
90 lines (74 loc) · 1.92 KB
/
Terminal.luau
File metadata and controls
90 lines (74 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
client, service = nil, nil
return function(data, env)
if env then
setfenv(1, env)
end
local termLines = {}
local gTable
local window = client.UI.Make("Window",{
Name = "Terminal";
Title = "Terminal";
Icon = client.MatIcons.Code;
Size = {500,300};
AllowMultiple = false;
OnClose = function()
end
})
local scroller = window:Add("ScrollingFrame",{
Size = UDim2.new(1, -10, 1, -40);
BackgroundTransparency = 1;
List = {};
})
local textbox = window:Add("TextBox",{
Text = "";
Size = UDim2.new(1, 0, 0, 30);
Position = UDim2.new(0, 0, 1, -30);
PlaceholderText = "Enter command";
TextXAlignment = "Left";
ClearTextOnFocus = false;
})
textbox:Add("UIPadding", {PaddingLeft = UDim.new(0, 6);})
local function out(put, lines)
table.insert(lines,put)
if #lines>500 then
table.remove(lines,1)
end
end
window:BindEvent(service.Events.TerminalLive, function(rData)
local data = rData.Data
local rType = rData.Type
out(data,termLines)
end)
textbox.FocusLost:Connect(function(enterPressed)
service.Debounce("_TERMINAL_BOX_FOCUSLOST",function()
if enterPressed and textbox.Text ~= "" and textbox.Text ~= "Enter command" then
local com = textbox.Text
local ret
textbox.Text = ""
out(`>{com}`,termLines)
ret = client.Remote.Get("Terminal",com,{
Time = time();
})
if ret and type(ret) == "table" then
for i,ent in ipairs(ret) do
out(ent,termLines)
end
end
--scroller:GenerateList(termLines, nil, true)
textbox:CaptureFocus()
--textbox.Text = "Enter command"
end
task.wait(0.1)
end)
end)
out(string.format("Adonis Terminal [%s]", string.match(client.Changelog[5], "%[(.+)%].+")), termLines)
gTable = window.gTable
window:Ready()
local last = 0
while gTable.Active and task.wait(0.5) do
if #termLines > last then
last = #termLines
scroller:GenerateList(termLines, nil, true)
end
end
end