diff options
Diffstat (limited to 'scripts/context/lua/mtxrun.lua')
-rw-r--r-- | scripts/context/lua/mtxrun.lua | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/scripts/context/lua/mtxrun.lua b/scripts/context/lua/mtxrun.lua index f792cd942..246d08103 100644 --- a/scripts/context/lua/mtxrun.lua +++ b/scripts/context/lua/mtxrun.lua @@ -709,20 +709,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 @@ -730,6 +732,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 = {} @@ -1146,6 +1150,7 @@ function table.tofile(filename,root,name,reduce,noquotes,hexify) serialize(root,name,flush,reduce,noquotes,hexify) end f:close() + io.flush() end end @@ -1381,6 +1386,7 @@ function io.savedata(filename,data,joiner) f:write(data or "") end f:close() + io.flush() return true else return false @@ -9406,7 +9412,7 @@ function resolvers.variableofformat(str) return formats[str] or formats[alternatives[str]] or '' end -function resolvers.vsriableofformatorsuffix(str) +function resolvers.variableofformatorsuffix(str) local v = formats[str] if v then return v |