Closed ghost closed 3 months ago
It's possible to forward-declare a local variable first before assigning.
local toUnpack = { 1, 2 }
local myTable = {}
local b: number
myTable.a, b = unpack(toUnpack)
This should give you the same behavior.
Oh, thank you I forgot about that!
You can
However you cannot unpack something into a table and local variable at the same time. This code gives you a syntax error.
Likewise, you cannot move the local keyword, or you will get a syntax error.
It would be nice to be able to do the code above rather than manually unpacking it.