Software /
code /
prosody
Comparison
util/multitable.lua @ 1104:e9c1650054c4
util.multitable: No globals today, thank you. Fixes missing table entries and a potential traceback
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 04 May 2009 19:06:31 +0100 |
parent | 896:2c0b9e3c11c3 |
child | 1523:841d61be198f |
comparison
equal
deleted
inserted
replaced
1102:c81df501fd38 | 1104:e9c1650054c4 |
---|---|
54 if n == _end then | 54 if n == _end then |
55 t[k] = nil; | 55 t[k] = nil; |
56 return; | 56 return; |
57 end | 57 end |
58 if k then | 58 if k then |
59 v = t[k]; | 59 local v = t[k]; |
60 if v then | 60 if v then |
61 r(v, n+1, _end, ...); | 61 r(v, n+1, _end, ...); |
62 if not next(v) then | 62 if not next(v) then |
63 t[k] = nil; | 63 t[k] = nil; |
64 end | 64 end |
94 t_insert(results, t[k]); | 94 t_insert(results, t[k]); |
95 end | 95 end |
96 return; | 96 return; |
97 end | 97 end |
98 if k then | 98 if k then |
99 v = t[k]; | 99 local v = t[k]; |
100 if v then | 100 if v then |
101 s(v, n+1, results, _end, ...); | 101 s(v, n+1, results, _end, ...); |
102 end | 102 end |
103 else | 103 else |
104 for _,b in pairs(t) do | 104 for _,b in pairs(t) do |