Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commands = {}
- commands.stringtable = function(input)
- local table2 = {}
- local f = 1
- for i=1,string.len(input) do
- if input:byte(i) == 32 then
- f = f + 1
- goto done
- else
- if f % 2 == 0 then
- if input:byte(i) < 48 or input:byte(i) > 57 then
- table2[f] = nil
- f = f+1
- end
- end
- if table2[f] == nil then
- table2[f] = input:sub(i, i)
- else
- table2[f] = table2[f]..input:sub(i, i)
- end
- end
- ::done::
- end
- return table2, f
- end
- while true do
- print("Awaiting command: ")
- local input = io.read()
- if input == "close" then break end
- local table2, f = commands.stringtable(input)
- for i, v in ipairs(table2) do
- print("Your command was: "..v)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement