diff options
Diffstat (limited to 'tex/context/base/l-table.lua')
-rw-r--r-- | tex/context/base/l-table.lua | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/tex/context/base/l-table.lua b/tex/context/base/l-table.lua index 331bd9ca0..996e36a83 100644 --- a/tex/context/base/l-table.lua +++ b/tex/context/base/l-table.lua @@ -193,20 +193,22 @@ function table.imerged(...) return tmp end -local function fastcopy(old) -- fast one +local function fastcopy(old,metatabletoo) -- fast one if old then local new = { } for k,v in next, old do if type(v) == "table" then - new[k] = fastcopy(v) -- was just table.copy + new[k] = fastcopy(v,metatabletoo) -- was just table.copy else new[k] = v end end - -- optional second arg - local mt = getmetatable(old) - if mt then - setmetatable(new,mt) + if metatabletoo then + -- optional second arg + local mt = getmetatable(old) + if mt then + setmetatable(new,mt) + end end return new else @@ -214,6 +216,8 @@ local function fastcopy(old) -- fast one end end +-- todo : copy without metatable + local function copy(t, tables) -- taken from lua wiki, slightly adapted tables = tables or { } local tcopy = {} @@ -660,6 +664,7 @@ function table.tofile(filename,root,name,reduce,noquotes,hexify) serialize(root,name,flush,reduce,noquotes,hexify) end f:close() + io.flush() end end |