LLEvents:once() with "touch_start" misses the first touch after reset in the editor
complete
SuzannaLinn Resident
local function start()
print("touched")
end
LLEvents:once("touch_start", start)
[save script]
(pointer is hand)
[touching]
-- > touched
(pointer is arrow)
[reset script in the editor]
(pointer is hand)
[touching]
(nothing) <- missed the first touch
(pointer is hand)
[touching]
-- > touched <- got the second touch
(pointer is arrow)
---
Works well with:
- Reset the script in the editor
- Take the object to inventory
- Rezz the object
- Touch -- > touched
---
Works well with LLEvents:on():
local function start()
print("touched")
end
LLEvents:on("touch_start", start)
Log In
H
Harold Linden
marked this post as
complete
Confirmed this is fixed in the latest release, thanks again!
H
Harold Linden
Wow, I guess
touch_start
contains all the "fun" bugs! Yep, it's specifically a problem with having a touch_start at first but resetting your script at a point where you don't have one anymore. Looks like that's a bug that's been in there for a looooong time. Should be fixed in the next release, thanks for sending this in!H
Harold Linden
I should note that this is only being fixed for SLua, I don't believe that anyone depends on this behavior, but I'm hesistant to change it without digging into existing usecases where someone might be implicitly depending on it.
SuzannaLinn Resident
A similar behaviour in LSL (in all of them Luau, Mono and Legacy):
default {
touch_start(integer num) {
llOwnerSay("touched");
state two;
}
}
state two{
state_entry() {
llOwnerSay("two");
}
}
[save script]
(pointer is hand)
[touching]
-- > touched
-- > two
(pointer is arrow)
[reset script in the editor]
(pointer is hand)
[touching]
(nothing) <- missed the first touch
(pointer is hand)
[touching]
-- > touched <- got the second touch
-- > two
(pointer is arrow)
H
Harold Linden
marked this post as
inĀ progress
Interesting, was able to repro with
LLEvents:once('touch_start', print)
.If I had to guess, this is something to do with the dynamic handler unregistration hooks that call out to the simulator. Having a look now.