diff options
author | 2019-09-29 15:30:18 +0200 | |
---|---|---|
committer | 2019-09-29 09:30:18 -0400 | |
commit | ed2b7e5ef1626c0d6318b6ea71897efbb4356277 (patch) | |
tree | 62a84a4a2c804922839dbfa60ec664b84beaaee0 /3rdparty/genie/src/base/table.lua | |
parent | 1bd1288c9e17bdba9544d1e56be7618106fece7e (diff) |
Synced with GENie upstream revision e78d6c1 (#5631)
* Synced with GENie upstream revision e78d6c1
* Add Visual Studio 2019 support
* Fix hardcoded -m64
* Switch appveyor to Visual Studio 2019
* Fix genie being built as 32-bit
* MSVC build is known to be broken currently. Let it fail until all the known issues are fixed.
* Update the packages before building
* Build with 3 threads
Appveyor VMs have only 2 cores and 8 GB RAM.
* Enable caching of pacman cache
Diffstat (limited to '3rdparty/genie/src/base/table.lua')
-rw-r--r-- | 3rdparty/genie/src/base/table.lua | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/3rdparty/genie/src/base/table.lua b/3rdparty/genie/src/base/table.lua index 7bf37e7628c..c982e78325a 100644 --- a/3rdparty/genie/src/base/table.lua +++ b/3rdparty/genie/src/base/table.lua @@ -171,6 +171,24 @@ -- +-- Return an iterator over key/value pairs in a table, sorted by key. +-- + + function table.sortedpairs(t) + local keys = table.keys(t) + local i = 0 + table.sort(keys) + return function() + i = i + 1 + if keys[i] == nil then + return nil + end + return keys[i], t[keys[i]] + end + end + + +-- -- Adds the key-value associations from one table into another -- and returns the resulting merged table. -- @@ -212,12 +230,12 @@ end return result end - - + + -- -- reverse table order -- - + function table.reverse(arr) for i=1, math.floor(#arr / 2) do arr[i], arr[#arr - i + 1] = arr[#arr - i + 1], arr[i] |