better vars
This commit is contained in:
parent
080120de2b
commit
e0acccdd81
|
@ -2416,6 +2416,7 @@ function check_version(v)
|
||||||
end
|
end
|
||||||
if v >= "1.2.0" then
|
if v >= "1.2.0" then
|
||||||
require ("goto")
|
require ("goto")
|
||||||
|
require ("vars");
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -11,11 +11,11 @@ function (f, k, v, s, ...) -- k - key, v - value, s -- parent table
|
||||||
return f(k, v, s, unpack(arg))
|
return f(k, v, s, unpack(arg))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
obj = inherit(obj,
|
function __vars_fill(v)
|
||||||
function(v)
|
|
||||||
local k,o
|
local k,o
|
||||||
local vars = {}
|
|
||||||
if type(v.var) == 'table' then
|
if type(v.var) == 'table' then
|
||||||
|
local k,o
|
||||||
|
local vars = {}
|
||||||
for k,o in pairs(v.var) do
|
for k,o in pairs(v.var) do
|
||||||
if tonumber(k) and type(o) == 'string' then
|
if tonumber(k) and type(o) == 'string' then
|
||||||
stead.table.insert(vars, o)
|
stead.table.insert(vars, o)
|
||||||
|
@ -26,5 +26,16 @@ function(v)
|
||||||
end
|
end
|
||||||
v.var = vars;
|
v.var = vars;
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
obj = inherit(obj,
|
||||||
|
function(v)
|
||||||
|
__vars_fill(v)
|
||||||
return v
|
return v
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
init = hook(init,
|
||||||
|
function (f, ...) -- k - key, v - value, s -- parent table
|
||||||
|
__vars_fill(_G)
|
||||||
|
return f(k, unpack(arg))
|
||||||
|
end)
|
||||||
|
|
Loading…
Reference in a new issue