From 01fd63f17c80e81218b3d65f1455a62c411dc6ff Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Tue, 30 Apr 2013 11:55:11 +0200 Subject: sync with Context from 2013-04-30 --- lualibs-table.lua | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'lualibs-table.lua') diff --git a/lualibs-table.lua b/lualibs-table.lua index 640bbbb..e57abe8 100644 --- a/lualibs-table.lua +++ b/lualibs-table.lua @@ -1094,7 +1094,7 @@ function table.tofile(filename,root,name,specification) end end -local function flattened(t,f,depth) +local function flattened(t,f,depth) -- also handles { nil, 1, nil, 2 } if f == nil then f = { } depth = 0xFFFF @@ -1110,19 +1110,16 @@ local function flattened(t,f,depth) if depth > 0 and type(v) == "table" then flattened(v,f,depth-1) else - f[k] = v + f[#f+1] = v end end end - local n = #f for k=1,#t do local v = t[k] if depth > 0 and type(v) == "table" then flattened(v,f,depth-1) - n = #f else - n = n + 1 - f[n] = v + f[#f+1] = v end end return f -- cgit v1.2.3