lua-users home
lua-l archive

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

On Tue, 22 Jun 2010 07:31:12 +0300, David Manura <> wrote:

To followup [1], can someone remind me what is the rationale for Lua
5.1 tables not storing an explicit table length, which thereby
prevents trailing nils from being regularly counted in the table
length?  I'm not suggesting storing length in a regular table key,
like the Lua 5.0 "n" field which affects things like pairs iteration,
but rather storing it in some hidden location accessible only via the
# operator.

The best summary was here (replace "definition" with "implementation"):

Main issue is that automatically maintaining the hidden "n" has a
runtime cost that is not acceptable for all users.