šŸ“ƒ SLua Alpha

General discussion and feedback on Second Life's SLua Alpha
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.
12
Ā·

planned

Table lengths, concatenation, and probably other things!
Currently there are surely a lot of little parity problems. These are just some that I've noticed so far- local a = {1, 2, 3, 4} local b = {1, 2, nil, 4} local c = {1, 2, d = 3, 4} ll.OwnerSay(`a {#a} `) ll.OwnerSay(`b {#b} `) ll.OwnerSay(`c {#c} `) A and B will return 4, but C will return 3. Getting the length of a table with dictionary elements requires looping thru the entire table with pairs() each time, requiring a cludgy metamethod to have it work how one would 'expect', when just a table.len() would be useful. local Tbl = {} Tbl.__index = Tbl Tbl.__len = function(len) local incr = 0 for _ in pairs(len) do incr = incr + 1 end return incr end Likewise, list concatenation is a major thing in SL, allowing one to build up lists for llSetLinkPrimitiveParams for instance to save on function calls. This is entirely impossible in Lua with merging even two tables requiring your own function, or another cludge, to say nothing of matching the functionality of SL where multiple lists can be strung together easily- Table. __concat = function(a, b) if type(b) == "table" then for _, v in ipairs(b) do a[#a+1]=v end else a[#a+1]=b end return a end } As these are probably minor, basic functions that would get a lot of use, I feel like small things like this should start being added to the language, to prevent them from needing to be created in every script itself. The performance would also be higher if implemented in C on top of that. Lua is advertised as being an extremely tiny language, but that can be a little detrimental when we have to make even basic helper functions ourselves in our limited 64kb memory.
2
Ā·

tracked

Load More
→