-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLua.lua
More file actions
39 lines (32 loc) · 801 Bytes
/
Lua.lua
File metadata and controls
39 lines (32 loc) · 801 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
local target = "hello world"
local index = 1
local pointer = 1
local ans = ""
local chars = {}
for c in ("abcdefghijklmnopqrstuvwxyz"):gmatch"." do table.insert(chars, c) end
function main()
local cur = chars[index]
index = index + 1
local targetIndex = target:sub(pointer, pointer)
if targetIndex == " " then
pointer = pointer + 1
ans = ans .. " "
end
if cur == target:sub(pointer, pointer) then
ans = ans .. cur
pointer = pointer + 1
end
local toLog = ans .. cur
if toLog:sub(-2) == "dd" then
print(toLog:sub(1, -2))
else
print(toLog)
end
if ans == target then
print("Successfully logged Hello World!")
os.exit()
end
if index > 26 then index = 1 end
main()
end
main()