I don't know what I do wrong. Basically the code looks like this:
local t = setmetatable({}, {__pairs = function (self)
print "Message from __pairs()"
return function ()
...
end
end})
for k, v in pairs(t) do ... end
The same for __ipairs(). Overloaded metamethods aren't called at all - no console output, no custom iteration at all. Instead I get the result as if I iterate through a table without metatable. What's wrong?