lua-users home
lua-l archive

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


On Tuesday, December 23, 2014 05:00:07 PM Soni L. wrote:
> Undefined behaviour

(Are you familiar with Inigo Montoya?)

The *n conversion is well described in the 5.3 manual. "returns it as a float 
or an integer, following the lexical conventions of Lua."

Even my other concern regarding negative indexes in the table library could be 
called defined. The definition of a sequence does not forbid negative 
integers. It only requires that all positive integers are consecutive. The 
table {"a","b",[-1]="x"} is a sequence with the defined "length" of 2. 
table.unpack is defined for the integer keys [i, i+1, ..., j] which is true 
for i=-1 and j=2. So while that is unusual and not strictly operating on a 
sequence, it isn't quite undefined either. It just took me three or four 
readings of the manual to notice the loophole that allows it.

-- 
tom <telliamed@whoopdedo.org>