lua-users home
lua-l archive

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


Additionally, if your function expects a sequence and your user knows it will operate on a sequence (e.g. for i = 1, #t), that doesn't necessarily stop them from putting other "metadata" into t (like t.something and t.somethingelse) that they know will not interfere with your function's processing of t. I do this sometimes myself: treat tables as sequences from the perspective of one set of functions, but another part of the program can still augment them with their own metadata, if they wish.


On Tue, Oct 1, 2013 at 9:51 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> I still feel the lack of an efficient way to determine if a table t is a sequence is a significant hole in the language/runtime.

Why would you need that? If you care that a table is a sequence, then either
you have created the table and know it or you have been handed a table and
can assume whoever gave you the table honors the contract with you to use
only sequences. What am I missing?