diff options
author | Benoit Giannangeli <giann008@gmail.com> | 2017-04-11 08:05:25 +0200 |
---|---|---|
committer | Benoit Giannangeli <giann008@gmail.com> | 2017-04-11 08:10:42 +0200 |
commit | 72e49b26d32423d66b68fb45e9aace9c503a1a5c (patch) | |
tree | 76354fc4cef276306ff355208e317b5166ccf24f /src/ltable.js | |
parent | c8cb77ea06cb2f1ca10cf63042a7cbea8d1c5e7a (diff) | |
download | fengari-72e49b26d32423d66b68fb45e9aace9c503a1a5c.tar.gz fengari-72e49b26d32423d66b68fb45e9aace9c503a1a5c.tar.bz2 fengari-72e49b26d32423d66b68fb45e9aace9c503a1a5c.zip |
Array.prototype.sort sort by Unicode code points by default
WTF JS !
Diffstat (limited to 'src/ltable.js')
-rw-r--r-- | src/ltable.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ltable.js b/src/ltable.js index 025efe0..039dd6d 100644 --- a/src/ltable.js +++ b/src/ltable.js @@ -14,7 +14,9 @@ const TValue = lobject.TValue; Table.prototype.ordered_intindexes = function() { return [...this.value.keys()] .filter(e => typeof e === 'number' && e % 1 === 0) // Only integer indexes - .sort(); + .sort(function (a, b) { + return a > b ? 1 : -1; + }); }; Table.prototype.ordered_indexes = function() { @@ -73,4 +75,4 @@ Table.prototype.luaH_next = function(L, keyI) { } return 0; -};
\ No newline at end of file +}; |