no nullfn, more clever hook

This commit is contained in:
p.kosyh 2010-06-19 14:59:57 +00:00
parent 91a6a9a8b3
commit 73f455dbf8

View file

@ -7,8 +7,6 @@ stead = {
os = os,
call_top = 0,
cctx = { txt = nil, self = nil },
nullfn = function()
end,
timer = function()
if type(timer) == 'table' and type(timer.callback) == 'function' then
return timer:callback();
@ -2332,8 +2330,10 @@ end
function hook(o, f)
return function(...)
if not o then
o = stead.nullfn
if type(o) ~= 'function' then
o = function(s)
return o;
end
end
return f(o, unpack(arg))
end