better vars

This commit is contained in:
p.kosyh 2010-06-18 09:16:07 +00:00
parent 080120de2b
commit e0acccdd81
2 changed files with 15 additions and 3 deletions

View file

@ -2416,6 +2416,7 @@ function check_version(v)
end
if v >= "1.2.0" then
require ("goto")
require ("vars");
end
end

View file

@ -11,11 +11,11 @@ function (f, k, v, s, ...) -- k - key, v - value, s -- parent table
return f(k, v, s, unpack(arg))
end)
obj = inherit(obj,
function(v)
function __vars_fill(v)
local k,o
local vars = {}
if type(v.var) == 'table' then
local k,o
local vars = {}
for k,o in pairs(v.var) do
if tonumber(k) and type(o) == 'string' then
stead.table.insert(vars, o)
@ -26,5 +26,16 @@ function(v)
end
v.var = vars;
end
end
obj = inherit(obj,
function(v)
__vars_fill(v)
return v
end)
init = hook(init,
function (f, ...) -- k - key, v - value, s -- parent table
__vars_fill(_G)
return f(k, unpack(arg))
end)