|
|
-
- -- local setmetatable = setmetatable
-
- -- local _slot = {}
- -- setmetatable(_slot, _slot)
-
- -- _slot.__call = function(self, ...)
- -- if nil == self.obj then
- -- return self.func(...)
- -- else
- -- return self.func(self.obj, ...)
- -- end
- -- end
-
- -- _slot.__eq = function (lhs, rhs)
- -- return lhs.func == rhs.func and lhs.obj == rhs.obj
- -- end
-
- -- --可用于 Timer 定时器回调函数. 例如Timer.New(slot(self.func, self))
- -- function slot(func, obj)
- -- local st = {func = func, obj = obj}
- -- setmetatable(st, _slot)
- -- return st
- -- end
|