lua-users home
lua-l archive

Re: Why does lua interpreter need = in front of variables?

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


Enrico Colombini wrote:
David Given wrote:
 for i = 1, n do out[i] = self end
Would "table.insert(out, self)" be faster or slower than the above?
Slower, I'd think. It needs to make an external function call (not to mention the table lookup required to find table.insert, but that's quibbling), and table.insert is inherently more complex than the simple assignment. I could be wrong, though; certainly, I've seen 't[#t+1]=7' recommended as the Right Way of adding items to an array.
--
David Given
dg@cowlark.com

AltStyle によって変換されたページ (->オリジナル) /