lua-users home
lua-l archive

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


Hi,

Alex Bilyk wrote:
> It seems setting LUA_NUMBER to anything besids `double` produces
> a load of "possible loss of data while converting <blah> to <blah2>"
> type of warnings in Lua libraries' code. Is this intentional?

Yes, because you need to adjust some other defines, too. If you are using
Lua-5.1-work2 everything can be tuned in one file: include/luaconf.h

Have a look at LUA_NUMBER, LUA_NUMBER_SCAN, LUA_NUMBER_FMT, lua_number2int,
lua_str2number and LUA_UACNUMBER (leave that to double if you use float,
but change it to long if you use long).

Important note: you need to recompile all of your extensions with the
modified defines or you'll get subtle and hard to find bugs. Oh and some
extensions may not work at all if you redefine LUA_NUMBER ...

> Also, FYI, when compiled with "Detect 64-bit Portability Issues" option
> set to "Yes" there will be a bunch of warnings generated all over the place.

Just a few days ago I have sent a patch that tries to fix all 64 bit issues.
It's available from the archives (relative to Lua-5.1-work2):

http://lua-users.org/lists/lua-l/2004-11/msg00032.html

Let's hope this is fixed in the next Lua release, but I haven't heard
anything from the Lua authors about it.

> This is on Win2K, MS VC7.1. 

I don't have any native Windows development environment (I cross-compile
everything from Linux). If you have the time, then please try this patch.
If there are any 64 bit portability warnings left, then forward them to me
and I'll see what I can do. Thank you!

Bye,
     Mike