lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi.

I'm using anonymous function in the following way:
I have something like a callback setup, eg.
something.event:Add(function ()
                                    print("blah")
                                  end)

.event also has a function inside it called Remove()
What I'd like to do is remove the anonymous function
from my event, with the function itself eg.

something.event:Add(function ()
                                   print("hello")
                                   something.event:Remove(self)
                                  end)

but this/self obviously isnt defined there.

My question, is there a way of addressing an anonymous
function inside itself ?

I hope that made sens, or maybe it doesnt because something
cannot remove itself, tho Remove() only removes it from the list,
so it should be possible in that respect ... ?

Thanks.
--
Reyn Vlietstra.