lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> meta = {__call=function(o,i) return next(o,i) end}
> tab = {"Rio", "London", "Berlin"}
> setmetatable(tab, meta)
> for _,v in tab do print(v) end
> 
> But now it prints "Rio" endlessly and the iteration does not advance. Can
> someone please show me the code to make this second case work?

meta = {__call=function(o,x,i) return next(o,i) end}