[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: suggestion: __typeof()
- From: "Vyacheslav Kalitkin" <vkalitkin@...>
- Date: Tue, 17 Jan 2006 21:18:50 +0300
The reason? It could be used with userdata, to provide more
information of the entity than just "userdata" does. For example, it
could provide "enum/SDL_INIT", telling that the entity is an
enumaration of logical type SDL_INIT.
I always create "class" property for my userdata objects to return class
name.
Instead I suggest to add a "__next" methamethod to userdata,
for iterate userdata with next() functions.
Today with "__len" I can iterate my userdata as
for i=1,#ud do ...ud[i]... end
But I hope you can add way to iterate userdata with
next(), pairs() and ipairs() functions.
for example
meta = { G={}}
meta.__index=meta.G
meta.__next=meta.G (or function what returned keys array or iterator
function)
setmetatable(ud,meta)
for k,v in pairs(ud) do ... end
Best regards,
Vyacheslav Kalitkin