Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tbl = {}
- local level = 0
- local temp_string = ""
- local cur_tbl = {}
- local function to_args(str)
- local split = str:Split(",")
- for key, val in pairs(split) do
- if val:sub(1,1) == [["]] then
- split[key] = val:sub(2,-2)
- elseif tonumber(val) then
- split[key] = tonumber(val)
- end
- end
- return split
- end
- for char in OK:gmatch("(.)") do
- if char == "[" then
- table.insert(cur_tbl, to_args(temp_string))
- cur_tbl
- temp_string = ""
- level = level + 1
- elseif char == "]" then
- temp_table = {} -- why is there this logic about
- level = level - 1
- else
- temp_string = temp_string .. char
- end
- end
- luadata.WriteFile("output.txt", tbl)
Advertisement
Add Comment
Please, Sign In to add comment