summaryrefslogtreecommitdiff
path: root/pairs_except.lua
blob: 1f808ecd9b53861d48edf54da3fb4dcb2766a41e (plain)
1
2
3
4
5
6
7
8
-- pairs_except(t, k) is the same as pairs(t), but with t[k] skipped
return function(t,exception)
	if exception == nil then return pairs(t) end
	local function next_except(t,k)
		local k2,v2 = next(t,k)
		if k2 == exception then k2,v2 = next(t,k2) end
		return k2,v2 end
	return next_except, t, nil end