Piznium source code snippets/Simple arithmetic maker/Early broken version

function splitIntoTable(inputstr,sep) local t = {} for str in string.gmatch(inputstr,"([^"..sep.."]+)") do   table.insert(t,str) end return t end

function displayList(table) for k, v in ipairs(table) do   print(table[k]) end end

local tocalc = "5 + 3 + 6"

print("Inputted: " .. tocalc) tocalc = "0 " .. tocalc local workwith = splitIntoTable(tocalc," ") local did = 0 local doing = 1 local lenOfWorkwith = 0

for k in pairs(workwith) do   lenOfWorkwith = lenOfWorkwith + 1 end

repeat if workwith[doing] == "+" then did = workwith[doing - 1] + workwith[doing + 1] end doing = doing + 1 until doing > lenOfWorkwith

did = math.floor(did + 0.5)

print("Result: " .. did)