diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-11-18 16:12:36 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2018-11-18 16:12:36 +0100 |
commit | 744095aa4676553437db0d71c281a74557a3222f (patch) | |
tree | bfdf5d203b5fbfa44ee7db705d3b3475361ad28f /tex/context/base/mkiv/l-table.lua | |
parent | e2ee706a3114129601a30908d6b8cbb57068d32c (diff) | |
download | context-744095aa4676553437db0d71c281a74557a3222f.tar.gz |
2018-11-18 14:16:00
Diffstat (limited to 'tex/context/base/mkiv/l-table.lua')
-rw-r--r-- | tex/context/base/mkiv/l-table.lua | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/tex/context/base/mkiv/l-table.lua b/tex/context/base/mkiv/l-table.lua index 69f45d9b4..eae135139 100644 --- a/tex/context/base/mkiv/l-table.lua +++ b/tex/context/base/mkiv/l-table.lua @@ -11,7 +11,6 @@ local table, string = table, string local concat, sort, insert, remove = table.concat, table.sort, table.insert, table.remove local format, lower, dump = string.format, string.lower, string.dump local getmetatable, setmetatable = getmetatable, setmetatable -local getinfo = debug.getinfo local lpegmatch, patterns = lpeg.match, lpeg.patterns local floor = math.floor @@ -830,22 +829,25 @@ local function do_serialize(root,name,depth,level,indexed) end elseif tv == "function" then if functions then - local f = getinfo(v).what == "C" and dump(dummy) or dump(v) -- maybe strip - -- local f = getinfo(v).what == "C" and dump(function(...) return v(...) end) or dump(v) -- maybe strip - if tk == "number" then - if hexify then - handle(format("%s [0x%X]=load(%q),",depth,k,f)) + local getinfo = debug and debug.getinfo + if getinfo then + local f = getinfo(v).what == "C" and dump(dummy) or dump(v) -- maybe strip + -- local f = getinfo(v).what == "C" and dump(function(...) return v(...) end) or dump(v) -- maybe strip + if tk == "number" then + if hexify then + handle(format("%s [0x%X]=load(%q),",depth,k,f)) + else + handle(format("%s [%s]=load(%q),",depth,k,f)) + end + elseif tk == "boolean" then + handle(format("%s [%s]=load(%q),",depth,k and "true" or "false",f)) + elseif tk ~= "string" then + -- ignore + elseif noquotes and not reserved[k] and lpegmatch(propername,k) then + handle(format("%s %s=load(%q),",depth,k,f)) else - handle(format("%s [%s]=load(%q),",depth,k,f)) + handle(format("%s [%q]=load(%q),",depth,k,f)) end - elseif tk == "boolean" then - handle(format("%s [%s]=load(%q),",depth,k and "true" or "false",f)) - elseif tk ~= "string" then - -- ignore - elseif noquotes and not reserved[k] and lpegmatch(propername,k) then - handle(format("%s %s=load(%q),",depth,k,f)) - else - handle(format("%s [%q]=load(%q),",depth,k,f)) end end else |