|
On Sep 17, 2014, at 7:16 AM, Steven Degutis <sbdegutis@gmail.com> wrote: Quoth polyglot:5.2 REFERENCE MANUAL No, I think the OP is correct insofar as what the reference manual says. My reading of the strict definition of sequence is that an empty table is NOT a sequence, and therefore the result of # is indeed undefined, regardless of what it actually returns in practice. (And yes, I’m on record as not liking this definition.) As I have noted before, since Lua provides no means to determine if a table is a sequence, it follows that unless you have control over the creation of a table, the length of the table is undefined, since your code cannot know if it is a sequence. This makes writing robust APIs that consume 3rd party tables problematic. —Tim |