more clever hook

This commit is contained in:
p.kosyh 2010-06-19 16:43:27 +00:00
parent 73f455dbf8
commit 10ebae3586

View file

@ -2330,12 +2330,15 @@ end
function hook(o, f)
return function(...)
local ff
if type(o) ~= 'function' then
o = function(s)
ff = function(s)
return o;
end
else
ff = o
end
return f(o, unpack(arg))
return f(ff, unpack(arg))
end
end