no nullfn, more clever hook
This commit is contained in:
parent
91a6a9a8b3
commit
73f455dbf8
|
@ -7,8 +7,6 @@ stead = {
|
||||||
os = os,
|
os = os,
|
||||||
call_top = 0,
|
call_top = 0,
|
||||||
cctx = { txt = nil, self = nil },
|
cctx = { txt = nil, self = nil },
|
||||||
nullfn = function()
|
|
||||||
end,
|
|
||||||
timer = function()
|
timer = function()
|
||||||
if type(timer) == 'table' and type(timer.callback) == 'function' then
|
if type(timer) == 'table' and type(timer.callback) == 'function' then
|
||||||
return timer:callback();
|
return timer:callback();
|
||||||
|
@ -2332,8 +2330,10 @@ end
|
||||||
|
|
||||||
function hook(o, f)
|
function hook(o, f)
|
||||||
return function(...)
|
return function(...)
|
||||||
if not o then
|
if type(o) ~= 'function' then
|
||||||
o = stead.nullfn
|
o = function(s)
|
||||||
|
return o;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return f(o, unpack(arg))
|
return f(o, unpack(arg))
|
||||||
end
|
end
|
||||||
|
|
Reference in a new issue