lua-users home
lua-l archive

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


> Seriously though, my attatchment to the feature idea is not strong;  
> it would just be a convenience. We do have code where the performance  
> difference is meaningful, but that's *not* the majority of places  
> where we append items, so I suppose we'll have to live with the more  
> cumbersome syntax reallyLongName[ #reallyLongName + 1 ] = v  where we  
> need the speed.

When you really need the speed, you should consider the use of an
explicit counter inside the inner loop:

  i = i + 1
  aVeryVeryLongNameWrittenOnlyOnce[i] = new value

This is still faster than "a[#a+1]" (and avoids the original problem).

-- Roberto