šŸ“ƒ SLua Alpha

General discussion and feedback on Second Life's SLua Alpha
Listeners stop listening after the first message
Listener doesn't work after the first message: local function listening(channel, name, id, msg) print(msg) end LLEvents:on("listen", listening) ll.Listen(1, "", "", "") [ typing: /1 hello] -- > hello [ typing: /1 hello] ( nothing ) --- Both listeners don't work after the first message to any of them local function listening(channel, name, id, msg) print(msg) end LLEvents:on("listen", listening) ll.Listen(1, "", "", "") ll.Listen(2, "", "", "") [ typing: /2 hello] -- > hello [ typing: /1 hello] ( nothing ) --- Event handlers are in place: local function listening(channel, name, id, msg) print(msg) end local function touching(events) for _, eventName in LLEvents:eventNames() do for _, myHandler in LLEvents:listeners(eventName) do print(`{eventName} : {debug.info(myHandler,"n")}`) end end end LLEvents:on("listen", listening) LLEvents:on("touch_start", touching) ll.Listen(1, "", "", "") [ typing: /1 hello] -- > hello [ touching ] -- > touch_start : touching -- > listen : listening [ typing: /1 hello] ( nothing ) --- This doesn't work, listeners are removed after calling the event handler: local function listening(channel, name, id, msg) print(msg) ll.Listen(1, "", "", "") end LLEvents:on("listen", listening) ll.Listen(1, "", "", "") --- This works: local function listening(channel, name, id, msg) print(msg) LLTimers:once(0.1, function() ll.Listen(1, "", "", "") ll.Listen(2, "", "", "") end) end LLEvents:on("listen", listening) ll.Listen(1, "", "", "") ll.Listen(2, "", "", "")
4
Ā·
complete
Events in SLua
There has already been some discussion of this in other canny's Like here But a centralized issue for feedback is probably a better idea. As the post by Harold Linden says in the above link, LL are considering something like LLEvents.touch_start = function ... Personally I would rather suggest something more akin to local handle = llevent.onTouchStart(function(touches:number) end) local handle = llevent.dispose(handle) or local handle = llevent.on(llevent.TOUCH_START, function(touches:number) end) llevent.dispose(handle) or (nya's suggestion) local function touchHandler(touches: number) end llevent.on(llevent.TOUCH_START, touchHandler) llevent.off(llevent.TOUCH_START, touchHandler) Mostly to allow for if not now, at least in the future multiple event handlers being setup and expanding to support things similar too function listenHandler(channel, name, key, msg) end local listener = ll.Listen(0,"","","test") llevent.on(llevent.LISTEN, listenHandler, listener) or function listenHandler(channel, name, key, msg) end llevent.on(llevent.LISTEN, listenHandler, {channel=0,message="test"}) Possibly something similar to roblox's "standard" , or something designed in a way that is compatible with it, so it can be properly extended later. This needs to happen BEFORE a possible beta phase There should also be NO COMPATABILITY with the current way of working, all current scripts SHOULD break and need rewriting, having both is not really a good option, and NOW is the time for breaking that.
26
Ā·
complete
Load More
→