[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pair()-like iterator in C++
- From: Leandro Pelorosso <vertexar@...>
- Date: Wed, 2 May 2007 10:02:56 -0700 (PDT)
I understand, i thinks that's what i'm going to do :)
Thank you very much!!
--- Rici Lake <lua@ricilake.net> wrote:
> Leandro Pelorosso wrote:
> > Indeed, but, don't you know what kind of undefined
> > behavior can i get?. (maybe something like iterate
> > elements that i already visit, or something like
> that)
>
> Undefined is undefined. You could get repeat
> elements,
> you could miss elements, you could get an error.
> About
> all you can say is that it won't crash.
>
> Your best bet is to add the new elements to another
> table and then merge them afterwards:
>
> do
> local newstuff = {}
> for k, v in pairs(tab) do
> -- whatever
> if some_condition then
> newstuff[newkey] = newval
> end
> end
>
> for k, v in pairs(newstuff) do
> tab[k] = v
> end
> end
>
>
>
------------------------------------
Dark Designs
www.darkdesigns.com.ar
Sign our Guestbook!
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com