lua-users home
lua-l archive

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


One could argue that it is better than perfect because you
can define your own interface.
e.g.

>  p = {1,2,3,4,5}
>  t={};t=setmetatable(t, {__index=function(t,k) return p[k] end})
>  t.next=function(t,v) return function(t,v) return next(p,v) end end
>  for k,v in t:next() do print(k,v) end
1       1
2       2
3       3
4       4
5       5


On  Chris wrote:
>  It's still not a perfect solution though because a table with a
> proxy doesn't support the interface of a real table.