https://typescripttolua.github.io/play/#code/GYVwdgxgLglg9mAVAAigCxmA5gZwBQCUyA3gFDIXICeMApgDYAmyARAIYsDc5lNDzLAEYtSAX1KlgcAE7I8EBDijIAHsjjBkAbQB0evFGkhayAPyoM2fEQBc2gLoFHJHhQAO0zFDwqCYoA
function* things() {
yield "a";
yield "b"
}
for (const x of [...(true ? things() : [])]) {
print(x)
}
This code incorrectly compiles down to a table.unpack instead of a lua-lib spread function, producing invalid results.
Expected output: print("a"); print("b");
Actual result: nothing
https://typescripttolua.github.io/play/#code/GYVwdgxgLglg9mAVAAigCxmA5gZwBQCUyA3gFDIXICeMApgDYAmyARAIYsDc5lNDzLAEYtSAX1KlgcAE7I8EBDijIAHsjjBkAbQB0evFGkhayAPyoM2fEQBc2gLoFHJHhQAO0zFDwqCYoA
This code incorrectly compiles down to a
table.unpackinstead of a lua-lib spread function, producing invalid results.Expected output: print("a"); print("b");
Actual result: nothing