Advertisement
Guest User

Untitled

a guest
Jun 13th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. --- serpent.lua.org 2012-06-13 15:04:36.894692373 +0200
  2. +++ serpent.lua 2012-06-13 15:04:39.126693082 +0200
  3. @@ -14,6 +14,7 @@
  4. local name, indent, fatal = opts['name'], opts['indent'], opts['fatal']
  5. local sparse, nocode, custom = opts['sparse'], opts['nocode'], opts['custom']
  6. local huge, space = not opts['nohuge'], (opts['compact'] and '' or ' ')
  7. + local maxlevel = opts['maxlevel']
  8. local seen, sref = {}, {}
  9. local function gensym(val) return tostring(val):gsub("[^%w]","") end
  10. local function safestr(s) return type(s) == "number" and (huge and snum[tostring(s)] or s)
  11. @@ -51,6 +52,7 @@
  12. "loadstring("..safestr(res)..",'@serialized')"..comment(t))
  13. return tag..(func or globerr(t))
  14. elseif ttype == "table" then
  15. + if level >= maxlevel then return '{}'..comment('maxlevel') end
  16. seen[t] = spath
  17. if next(t) == nil then return tag..'{}'..comment(t) end -- table empty
  18. local maxn, o, out = #t, {}, {}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement