lua-users home
lua-l archive

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

> I changed that isdigit() back to isalnum() in the second loop, but
> added a check that ls->current is > 0.  That works as well.  I still
> don't know where that -1, 0xff comes from, but at least stuff works
> for now.

The -1 comes from Lua itself. It is EOZ, the mark for end of input.
Lua assumes that is*(-1) should be false. The ISO standard says that
these functions should accept EOF:

  The header <ctype.h> declares several functions useful for classifying
  and mapping characters.) In all cases the argument is an int, the
  value of which shall be representable as an unsigned char or shall equal
  the value of the macro EOF.

But actually the standard does not say that EOF should be -1 (it only
says that EOF should be a negative integer), nor that EOF could not be a
digit ;)

-- Roberto