-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstring.lua
33 lines (26 loc) · 850 Bytes
/
string.lua
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
--[[
This shouldn't be necessary, but here we are.
Note: This was designed for a Lua 5.1 environment, so that's why I don't just use `string.split`.
If you don't wanna open up another Studio SE tab, you can just use https://www.jdoodle.com/execute-lua-online/ to run this.
The values printed from this can be thrown directly into a ZxxxxxxA instruction.
--]]
function SplitIntoCharacters(input)
local Table = {}
for i = 1, #input do
table.insert(Table, string.sub(input, i, i))
end
return Table
end
function PadZeroes(num)
local a = tostring(num)
while #a < 8 do
a = "0" .. a
end
return a
end
local str = 'Hello world!' -- This is what'll be converted.
local init = ""
for _, char in pairs(SplitIntoCharacters(str)) do
init = init .. PadZeroes(string.byte(char)) .. " "
end
print(init)