lua-users home
lua-l archive

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


Mark Hamburg wrote:
> > But it would make sense to use an out-of-the-box configuration
> > where lua_Integer is a subset of lua_Number. One could just use
> > LUAI_INT32.
> > 
> > Alas, it's a bit too late to fix that now. Changing lua_Integer
> > would break the Lua 5.1 ABI.
> 
> My primary use case for integers exceeding the range of ints are
> file offsets. These will pretty much always fit in the precision
> afforded by double but often not in the precision afforded by
> int.

But 64 bit file offsets are not specific to 64 bit platforms. In
other words: using lua_Integer means your code would certainly
break on a 32 bit platform.

That's why e.g. the LJ2 code for fp:seek() (in lib_io.c) uses the
equivalent of lua_tonumber() and lua_pushnumber() for that purpose.

--Mike