mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-29 08:14:35 +00:00
fixed accidentally global callback in subscribe_once
This commit is contained in:
parent
94d9901728
commit
c6e6ec858c
@ -98,7 +98,7 @@ end
|
|||||||
--subscribe to an event, automatically unsubscribe once called
|
--subscribe to an event, automatically unsubscribe once called
|
||||||
function pubsub:subscribe_once(event, callback)
|
function pubsub:subscribe_once(event, callback)
|
||||||
local called = false
|
local called = false
|
||||||
f = function(...)
|
local f = function(...)
|
||||||
if not called then
|
if not called then
|
||||||
callback(...)
|
callback(...)
|
||||||
self:unsubscribe(event, f)
|
self:unsubscribe(event, f)
|
||||||
|
Loading…
Reference in New Issue
Block a user