lua-users home
lua-l archive

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

Pierre Chapuis wrote:
> However I like Alexander's suggestion to add a function to tell
> whether a table is a List.

A list? You probably mean an array without holes.

There's no way to do that without traversing the whole table. All
shortcuts that try to infer something from e.g. #t or next() will
fail under some circumstances.

In other words: avoid APIs where you need to auto-detect such a
property. Instead, let the user of the API tell you what they
provide and/or what output representation they want.