You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clue supports renameable destructuring - local {a => b} = t read as "assign t.a to local b" - but currently only identifier fields are allowed (names that can index tables through dot notation).
It would be nice if we can also use value types for the source field, similar to Lua letting you use any non-nil type as a table key.
local {[1] =>a, [2] =>b} = {"hello", "world"}
//-- now a is "hello" and b is "world"local {[true] =>c, ["string field"] =>d} = {[true] =false, ["string field"] ="yes"}
//-- c is now false, d is now "yes"
Better too if the source key will support expressions in general
local {[4] => {[iter] =>x, [iter+1] =>y}} =points//-- x would be the value of points[4][iter], y would be points[4][iter+1]
Additionally, a separate syntax for destructuring arrays sequential-index tables may be helpful too
local [x,y,z] = {1, 0, 64}
//-- x = 1, y = 0, z = 64
The text was updated successfully, but these errors were encountered:
[...] keys in destructuring was added, but the array destructuring would need to work too differently to be simply added to table destructuring, and would have to be added as its own thing...
unless I find a way.
Clue supports renameable destructuring -
local {a => b} = t
read as "assignt.a
tolocal b
" - but currently only identifier fields are allowed (names that can index tables through dot notation).It would be nice if we can also use value types for the source field, similar to Lua letting you use any non-nil type as a table key.
Better too if the source key will support expressions in general
Additionally, a separate syntax for destructuring
arrayssequential-index tables may be helpful tooThe text was updated successfully, but these errors were encountered: