1
0
Fork 0
mirror of https://github.com/Reuh/ubiquitousse.git synced 2025-10-27 09:09:30 +00:00

Fix onUpdate not receiving self argument

This commit is contained in:
Étienne Fildadut 2021-04-13 01:25:27 +02:00
parent aa45a2cdac
commit cc0ed18eb3

View file

@ -44,7 +44,7 @@ local timer_mt = {
self.t.times = count or -1 self.t.times = count or -1
return self return self
end, end,
--- The TimedFunction will be active for a time duration. --- The timer will be active for a time duration.
-- Specify no time to remove condition. -- Specify no time to remove condition.
during = function(self, time) during = function(self, time)
self.t.during = time self.t.during = time
@ -118,8 +118,8 @@ local timer_mt = {
end, end,
--- Chaining --- --- Chaining ---
--- Creates another TimedFunction which will be replace the current one when it ends. --- Creates another timer which will be replace the current one when it ends.
-- Returns the new TimedFunction. -- Returns the new timer (and not the original one!).
chain = function(self, func) chain = function(self, func)
local fn = timer_module.run(func) local fn = timer_module.run(func)
self:onEnd(function(self, lag) self:onEnd(function(self, lag)
@ -170,7 +170,7 @@ local timer_mt = {
local _, _, cdt, lag = coroutine.yield() local _, _, cdt, lag = coroutine.yield()
return cdt, lag return cdt, lag
end)) end))
for _, f in ipairs(t.onUpdate) do f(t.object, startLag) end for _, f in ipairs(t.onUpdate) do f(self, startLag) end
if t.during then t.during = t.during - startLag - cdt end if t.during then t.during = t.during - startLag - cdt end
-- stopping / repeat -- stopping / repeat
if all(t.stopWhen, false) then t.forceStop = true end if all(t.stopWhen, false) then t.forceStop = true end
@ -196,7 +196,7 @@ local timer_mt = {
end, end,
--- Check if the timer is dead. --- Check if the timer is dead.
-- You shouldn't need to worry about this if your timer belongs to a registry? -- You shouldn't need to worry about this if your timer belongs to a registry.
-- If you don't use registries, you probably should purge dead timers to free up some memory (dead timers don't do anything otherwise). -- If you don't use registries, you probably should purge dead timers to free up some memory (dead timers don't do anything otherwise).
-- @treturn bool true if the timer can be discarded, false if it's still active. -- @treturn bool true if the timer can be discarded, false if it's still active.
-- @impl ubiquitousse -- @impl ubiquitousse
@ -244,7 +244,7 @@ local registry_mt = {
return r return r
end, end,
--- Cancels all the running TimedFunctions. --- Cancels all the running timers in this registry.
-- @impl ubiquitousse -- @impl ubiquitousse
clear = function(self) clear = function(self)
self.timers = {} self.timers = {}