CapsAdmin

Untitled

Mar 12th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local tbl = {}
  2. local level = 0
  3. local temp_string = ""
  4. local cur_tbl = {}
  5.  
  6. local function to_args(str)
  7.     local split = str:Split(",")       
  8.    
  9.     for key, val in pairs(split) do
  10.         if val:sub(1,1) == [["]] then
  11.             split[key] = val:sub(2,-2)
  12.         elseif tonumber(val) then
  13.             split[key] = tonumber(val)
  14.         end
  15.     end
  16.    
  17.     return split
  18. end
  19.  
  20. for char in OK:gmatch("(.)") do
  21.     if char == "[" then
  22.         table.insert(cur_tbl, to_args(temp_string))
  23.         cur_tbl
  24.        
  25.         temp_string = ""   
  26.         level = level + 1
  27.     elseif char == "]" then        
  28.        
  29.        
  30.         temp_table = {} -- why is there this logic about
  31.         level = level - 1
  32.     else   
  33.         temp_string = temp_string .. char
  34.     end
  35. end
  36.  
  37. luadata.WriteFile("output.txt", tbl)
Advertisement
Add Comment
Please, Sign In to add comment