diff --git a/Controller/wheatController.lua b/Controller/wheatController.lua new file mode 100644 index 0000000..a14f235 --- /dev/null +++ b/Controller/wheatController.lua @@ -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 \ No newline at end of file