Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function littleSerial(tbl, spc)
- spc = spc or 2
- local str = "{\n"
- local function app(a)
- str = str .. a
- end
- local last = 0
- local repStr = string.rep(' ', spc)
- for i, v in ipairs(tbl) do
- if i ~= i + 1 then
- app(string.format("%s[ %d ] = ", repStr, i))
- last = math.huge
- else
- last = last + 1
- end
- if type(v) = "table" then
- app(littleSerial(v, spc + 2) .. ",\n")
- else
- app(repStr .. tostring(v) .. ",\n")
- end
- end
- app("}")
- return str
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement