Does anybody know actual implementation of lua 5.2. metamethod __pairs ? In other words, how do I implement __pairs as a metamethod in a metatable so that it works exactly same with pairs() ? I need to override __pairs and want to skip some dummy variables that I add in a table. The following would use the metatable meta to explicitly provide pairs default behavior: function meta.__pairs(t) return next, t, nil end Now, for skipping specific elements, we must replace the returned next : function meta.__pairs(t) return function(t, k) local v repeat k, v = next(t, k) until k == nil or theseok(t,