summaryrefslogtreecommitdiff
path: root/lualibs-table.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-12-25 22:32:54 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2013-12-25 22:32:54 +0100
commit8823c59ae9a86ecd8b765d5f936be894582777dc (patch)
tree8ea8e3979e0973dfa13f94a763940403f2790224 /lualibs-table.lua
parenta82cbf2bce00df54f59d1b81805e8b40029b93c6 (diff)
downloadlualibs-8823c59ae9a86ecd8b765d5f936be894582777dc.tar.gz
sync with Context as of 2013-12-25
Diffstat (limited to 'lualibs-table.lua')
-rw-r--r--lualibs-table.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/lualibs-table.lua b/lualibs-table.lua
index c6bbc62..f361f3d 100644
--- a/lualibs-table.lua
+++ b/lualibs-table.lua
@@ -129,10 +129,13 @@ local function sortedhash(t,cmp)
s = sortedkeys(t) -- the robust one
end
local n = 0
+ local m = #s
local function kv(s)
- n = n + 1
- local k = s[n]
- return k, t[k]
+ if n < m then
+ n = n + 1
+ local k = s[n]
+ return k, t[k]
+ end
end
return kv, s
else