Can't remove or change event callbacks
GERgta Resident
In Lua, I can add an event callback using
LLEvent.touch_start = function()...
, but I cannot remove an event handler by doing LLEvent.touch_start = nil
. Doing so results in this error:"invalid argument #3 to '__newindex' (function or callable table expected, got nil)"
This is despite
LLEvent.touch_start
being nil by default!If I use
list.remove
instead, I get "invalid argument #1 to 'remove' (table expected, got LLEvents)".So as it is right now, it seems impossible to remove a handler.
Log In
GERgta Resident
Thank you very much! This can be closed.
SuzannaLinn Resident
Documentation on LLEvents: https://suzanna-linn.github.io/slua/moving-events
Frio Belmonte
You can remove event handlers with LLEvents:off(type, callback_reference), e.g. LLEvents:off("touch_start", my_touch_handler).
GERgta Resident
In fact, you can't change the callback either. Trying to do so leaves the event function unchanged.