31 lines
556 B
Text
31 lines
556 B
Text
function stringToByteArray(str)
|
|
return string.byte(str, 1, str:len())
|
|
end
|
|
|
|
function argsToTable(...)
|
|
return { ... }
|
|
end
|
|
|
|
function stringFromByteArray(...)
|
|
return string.char(...)
|
|
end
|
|
|
|
function iterateFileLines(path)
|
|
local handle = fs.open(path, "r")
|
|
local commands = {}
|
|
local line = handle.readLine()
|
|
while line do
|
|
commands[#commands + 1] = line
|
|
line = handle.readLine()
|
|
end
|
|
handle.close()
|
|
return commands
|
|
end
|
|
|
|
local function string_separate(str)
|
|
local t = {}
|
|
for i in string.gmatch(str, "[A-z]") do
|
|
table.insert(t, i)
|
|
end
|
|
return t
|
|
end
|