From 73f455dbf8ab29ca31333ad863fdaf2f992b4d3f Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Sat, 19 Jun 2010 14:59:57 +0000
Subject: [PATCH] no nullfn, more clever hook
---
stead/stead.lua | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/stead/stead.lua b/stead/stead.lua
index 40450cc..2167810 100644
--- a/stead/stead.lua
+++ b/stead/stead.lua
@@ -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