aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenoit Giannangeli <giann008@gmail.com>2017-04-11 08:05:25 +0200
committerBenoit Giannangeli <giann008@gmail.com>2017-04-11 08:10:42 +0200
commit72e49b26d32423d66b68fb45e9aace9c503a1a5c (patch)
tree76354fc4cef276306ff355208e317b5166ccf24f /src
parentc8cb77ea06cb2f1ca10cf63042a7cbea8d1c5e7a (diff)
downloadfengari-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')
-rw-r--r--src/ltable.js6
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
+};