Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function split(str)
- local b = {}
- local c = 1
- local d = {}
- string.gsub(str, "[%w-]", function(a)
- if (a == "-") then
- c = c + 1
- else
- if (not b[c]) then
- b[c] = {}
- end
- table.insert(b[c], a)
- end
- end)
- for k, v in pairs (b) do
- table.insert(d, table.concat(v))
- end
- return d
- end
- local string = "CHAOTIC:SCENARIO-name-0-0-name-description"
- local test = split(string)
- for k,v in pairs(test) do
- print(v)
- end
Advertisement
Add Comment
Please, Sign In to add comment