Skip to content

Instantly share code, notes, and snippets.

@hazzard993
Created April 9, 2019 03:49
Show Gist options
  • Save hazzard993/71ad5d1e43a2fdeecf33fc976ceddd1c to your computer and use it in GitHub Desktop.
Save hazzard993/71ad5d1e43a2fdeecf33fc976ceddd1c to your computer and use it in GitHub Desktop.
In TSTL, iterate using pairs, not Symbol.Iterator
// Works on 0.17.0
/**
* @tupleReturn
* @luaIterator
*/
declare function pairs(object: object): Iterable<[string, any]>;
declare const print: any;
let o = { a: 0, b: 1, c: 2 };
for (const [key, value] of pairs(o)) {
print(key, value);
}