diff options
author | Karl Berry <karl@freefriends.org> | 2019-11-05 21:36:14 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-11-05 21:36:14 +0000 |
commit | 9e63b55e701a371d05992e63c3bb88c3b574ad76 (patch) | |
tree | 308b1549e0e231a7763604d9d64aa7273d8023d5 /Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua | |
parent | bc37372594a99affc612160cc16daec4df3079a0 (diff) |
lualibs (5nov19)
git-svn-id: svn://tug.org/texlive/trunk@52648 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua index f970d8ace0f..410292ca8ab 100644 --- a/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua +++ b/Master/texmf-dist/tex/luatex/lualibs/lualibs-util-tab.lua @@ -341,7 +341,21 @@ function table.fastserialize(t,prefix) -- todo, move local function out m = m + 1 r[m] = "{" if n > 0 then - for i=0,n do + local v = t[0] + if v then + local tv = type(v) + if tv == "string" then + m = m + 1 r[m] = f_indexed_string(0,v) + elseif tv == "number" then + m = m + 1 r[m] = f_indexed_number(0,v) + elseif tv == "table" then + m = m + 1 r[m] = f_indexed_table(0) + fastserialize(v) + elseif tv == "boolean" then + m = m + 1 r[m] = f_indexed_boolean(0,v) + end + end + for i=1,n do local v = t[i] local tv = type(v) if tv == "string" then @@ -355,6 +369,8 @@ function table.fastserialize(t,prefix) -- todo, move local function out end end end + -- hm, can't we avoid this ... lua should have a way to check if there + -- is a hash part for k, v in next, t do local tk = type(k) if tk == "number" then @@ -411,7 +427,7 @@ function table.deserialize(str) return code end --- inspect(table.fastserialize { a = 1, b = { 4, { 5, 6 } }, c = { d = 7, e = 'f"g\nh' } }) +-- inspect(table.fastserialize { a = 1, b = { [0]=4, { 5, 6 } }, c = { d = 7, e = 'f"g\nh' } }) function table.load(filename,loader) if filename then |