-
Notifications
You must be signed in to change notification settings - Fork 11
Difference Reference
hazzard993 edited this page Feb 9, 2019
·
2 revisions
function x(...spread) { // function x(...) in Lua
print(...spread);
}
Arrays start at 1 for Lua.
The TypescriptToLua transpiler uses 0-indexed arrays.
let a = [];
table.insert(a, true);
print(a[0]); // transpiled version prints true
Javascript cannot return multiple values, but it can destructure them.
function tuple() {
return [3, 4, 5];
}
let [a, b, c] = tuple(); // Array destructure
print(a, b, c); // 3, 4, 5
class Player {
constructor() {}
update() {}
draw() {}
}
let p = new Player();
p.draw(); // transpiles to p:draw()