[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Shorthand for appending to a table (was Re: 5.2 feature list?)
- From: Tim Gogolin <tgogolin@...>
- Date: Mon, 11 Sep 2006 13:03:46 -0500
Right; I understand this point of view. The problem though is that
table.insert(t, v ) has a hash lookup penalty and a function call
penalty.
local table_insert = table.insert
will get rid of the hash lookup, but the function call is somewhat
painful inside a tight loop.
I've actually found myself making local tables named "t" (where
otherwise I had more meaningful names), in order to make the append
easier to read... which is unfortunate.
--
Tim Gogolin
Lightroom Engineer, Adobe Systems
On Sep 11, 2006, at 12:50 PM, Dave Nichols wrote:
I disagree, why should an integer index be any more significant
than a name?
I think a missing index should be a syntax error as it is now.
Use table.insert instead, it defaults to #+1
Regards,
Dave Nichols
Match-IT Limited
Tel: 0845 1300 510
Fax: 0845 1300 610
mailto:dave.nichols@make247.co.uk
http://www.make247.co.uk
Email Disclaimer: The contents of this electronic mail message and any
attachments (collectively "this message") are confidential, possibly
privileged and intended only for its addressee ("the addressee"). If
received in error, please delete immediately without disclosing its
contents
to anyone. Neither the sender nor its management or employees will
in any
way be responsible for any advice, opinion, conclusion or other
information
contained in this message or arising from it's disclosure.