From 72e49b26d32423d66b68fb45e9aace9c503a1a5c Mon Sep 17 00:00:00 2001 From: Benoit Giannangeli Date: Tue, 11 Apr 2017 08:05:25 +0200 Subject: Array.prototype.sort sort by Unicode code points by default WTF JS ! --- src/ltable.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ltable.js') 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 +}; -- cgit v1.2.3-54-g00ecf