-- 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