-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathError.lua
More file actions
47 lines (37 loc) · 928 Bytes
/
Error.lua
File metadata and controls
47 lines (37 loc) · 928 Bytes
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
local Error = {}
function Error.print(error)
term.setTextColor(colors.red)
print(error)
term.setTextColor(colors.white)
end
function Error.print(n, error, tokens)
ns = tostring(n)
term.setTextColor(colors.red)
prep="Line "..ns..": "
write(prep)
for i = 1,3 do
token = tokens[i]
if i == error.n then
term.setTextColor(colors.lightBlue)
else
term.setTextColor(colors.white)
end
if token == nil then
if i == error.n then
write("_ ")
elseif i < error.n then
write("_ ")
end
else
write(token.." ")
end
end
print("")
for i = 1,string.len(prep) do
write(" ")
end
term.setTextColor(colors.red)
print(error.error)
term.setTextColor(colors.white)
end
return Error