Upload files to 'Controller'

This commit is contained in:
manuel 2023-01-11 18:40:59 +00:00
parent 4bee1219a1
commit c01c7f4b9e

View File

@ -0,0 +1,30 @@
function toMatrix(str)
local matrix = {}
assert(type(str) == "string")
assert(str:sub(1,1) == "{", "the string must begin with a \"{\"")
local len = str:len()
assert(str:sub(len,len) == "}", "the string must end with a \"}\"")
local s1, ob = str:gsub("{", "{")
local s2, cb = str:gsub("}", "}")
assert(ob == cb, "the string must have the same amount of opening brackets as closing brackets")
str = str:sub(2, len - 1)
len = len - 2
if(str:sub(1,1) == "{") then
end
end
function toArray(str)
local len = str:len()
local comma = str:sub(",")
local arr = {}
while(type(comma)=="number") do
arr[#arr+1] = str:sub(1, comma-1)
str = str:sub(comma + 1, len)
len = str:len()
comma = str:sub(",")
end
return arr
end