Use ipairs() for helper.child_range

This commit is contained in:
Celtic Minstrel 2015-09-29 14:46:41 -04:00
parent 7fb0831da6
commit 2c337d4115
2 changed files with 5 additions and 6 deletions

View file

@ -72,17 +72,16 @@ end
--! Returns an iterator over all the subtags of @a cfg with the given @a name.
function helper.child_range(cfg, tag)
local iter, s, i = ipairs(cfg)
local function f(s)
local c
local i,c = s.i
repeat
local i = s.i
c = cfg[i]
i,c = iter(cfg,i)
if not c then return end
s.i = i + 1
until c[1] == tag
return c[2]
end
return f, { i = 1 }
return f, {i = 1}
end
--! Returns an array from the subtags of @a cfg with the given @a name

View file

@ -229,7 +229,7 @@ static int impl_vconfig_size(lua_State *L)
static int impl_vconfig_collect(lua_State *L)
{
vconfig *v = static_cast<vconfig *>(lua_touserdata(L, 1));
v->vconfig::~vconfig();
v->~vconfig();
return 0;
}