protected call in ref

This commit is contained in:
p.kosyh 2010-07-24 17:34:41 +00:00
parent 49745927e4
commit 21cb8e23e1

View file

@ -497,7 +497,11 @@ function ref(n) -- ref object by name
return n; return n;
end end
if type(n) == 'function' then if type(n) == 'function' then
return ref(n()); local r,v = pcall(n);
if not r then
return nil
end
return ref(v);
end end
return nil return nil
end end