[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Any thoughts on indexing ...?
- From: Mark Hamburg <mhamburg@...>
- Date: Wed, 09 Apr 2008 09:51:31 -0700
on 4/9/08 5:47 AM, Mike Pall at mikelu-0804@mike.de wrote:
> And apairs() could replace the 'for i,x in pairs{a,b,c} do' idiom,
> too. apairs() creates a closure, which is more lightweight than
> creating a table plus its array part.
Though if we're worrying about optimization, it would be nice to recognize
that if given something like:
for i, x in ipairs{ "a", "b", "c" } do
--
end
Then the constructed table can be lifted out as a constant.
Of course, that assumes that one knows what ipairs does and that it doesn't
modify the table in some way which of course we don't know...
Mark