no call func in ref while search
This commit is contained in:
parent
0a11826b83
commit
ff3de03557
|
@ -486,18 +486,18 @@ function obj(v)
|
|||
end
|
||||
|
||||
|
||||
function ref(n) -- ref object by name
|
||||
function ref(n, nofunc) -- ref object by name
|
||||
if type(n) == 'string' then
|
||||
local f = loadstring('return '..n);
|
||||
if f then
|
||||
return ref(f());
|
||||
return ref(f(), nofunc);
|
||||
end
|
||||
return nil;
|
||||
end
|
||||
if type(n) == 'table' then
|
||||
return n;
|
||||
end
|
||||
if type(n) == 'function' then
|
||||
if type(n) == 'function' and not nofunc then
|
||||
local r,v = pcall(n);
|
||||
if not r then
|
||||
return nil
|
||||
|
@ -578,7 +578,7 @@ end
|
|||
function list_find(self, name)
|
||||
local n, v, ii
|
||||
for n,v,ii in opairs(self) do
|
||||
if ref(v) == ref(name) then
|
||||
if ref(v) == ref(name, true) then -- do not call func while search
|
||||
return ii;
|
||||
end
|
||||
end
|
||||
|
|
|
@ -61,7 +61,7 @@ __do_xact = function(str, self)
|
|||
else
|
||||
oo = objs():srch(o)
|
||||
if not oo then
|
||||
oo = ref(o)
|
||||
oo = ref(o, true)
|
||||
end
|
||||
end
|
||||
elseif isObject(self) then
|
||||
|
@ -71,7 +71,7 @@ __do_xact = function(str, self)
|
|||
error("Wrong link: "..s, 3);
|
||||
end
|
||||
d = d:gsub("<:>", ":");
|
||||
return xref(d, ref(oo), unpack(aarg));
|
||||
return xref(d, ref(oo, true), unpack(aarg));
|
||||
end
|
||||
if type(str) ~= 'string' then return end
|
||||
local s = stead.string.gsub(str,'{[^}]+}', xrefrep);
|
||||
|
|
Reference in a new issue