Skip to content

Commit 378f543

Browse files
author
airstruck
committed
allow timer re-registration
1 parent 2d1b669 commit 378f543

File tree

4 files changed

+170
-126
lines changed

4 files changed

+170
-126
lines changed

knife/timer.lua

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ local function attach (group, item)
2121
item.index = index
2222
group[index] = item
2323
item.groupField = group
24+
item.lastGroup = group
2425
end
2526

2627
-- instance update methods
@@ -117,6 +118,12 @@ local function remove (self)
117118
return self
118119
end
119120

121+
local function register (self)
122+
attach(self.lastGroup, self)
123+
124+
return self
125+
end
126+
120127
local function limit (self, limitField)
121128
self.limitField = limitField
122129

@@ -167,6 +174,7 @@ local function initialize (timer)
167174
timer.elapsed = 0
168175
timer.group = group
169176
timer.remove = remove
177+
timer.register = register
170178

171179
attach(defaultGroup, timer)
172180

0 commit comments

Comments
 (0)