more clever hook
This commit is contained in:
parent
73f455dbf8
commit
10ebae3586
|
@ -2330,12 +2330,15 @@ end
|
||||||
|
|
||||||
function hook(o, f)
|
function hook(o, f)
|
||||||
return function(...)
|
return function(...)
|
||||||
|
local ff
|
||||||
if type(o) ~= 'function' then
|
if type(o) ~= 'function' then
|
||||||
o = function(s)
|
ff = function(s)
|
||||||
return o;
|
return o;
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
ff = o
|
||||||
end
|
end
|
||||||
return f(o, unpack(arg))
|
return f(ff, unpack(arg))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Reference in a new issue