lua-users home
lua-l archive

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


Bogdan Marinescu wrote:
> > In Lua 5.1 (work4) this seems to have been updated and should work with
> > 16-bit ints. Lua is written with portability in mind but I don't know if
> > there are any other gotchas around.
>    I see, thanks. Then perharps it is a better idea to start modifying
> the code just in case.

It's simpler to ignore the (harmless) warning and upgrade to 5.1 later.
Or start with 5.1 right now, depending on the expected release schedule
of your project (because 5.1 may be officially released by then).

> I guess that lua works just fine under
> platforms for which the following is generally true (please correct me
> if I'm wrong, I'm quite a newbie when it comes to lua):

I've posted a matrix showing the supported integer data models here:

Coincidentially the referenced patch fixes 16 bit portability problems, too.
It has been merged into Lua 5.1 work3.

>    sizeof( long long ) == 8

The Lua core does not make use of 64 bit datatypes, except implicitly
through size_t or ptrdiff_t (which happen to be 64 bit on a 64 bit box).

>    sizeof( float ) == 4
>    sizeof( double) == 8

You can define lua_Number to be a double (default), float or any integer
with at least 32 bits. There are side effects though and some extensions
may cease to work due to the limited range of floats or ints. The core
should be fine, though.

Have a look at the list archive and search for "lua_Number", to see what
the issues are. In Lua 5.1 everything configurable has been collected
in luaconf.h.