lua-users home
lua-l archive

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

The problem is that many (standard) floating point functions are used in the C code. These function calls cannot be removed by modifying the configuration file. Also, many math constants are used, which may not be defined in the math library being used. The "fixing a few library calls..." is not that easy and as you say, it's error prone.

IMHO, the best solution would be to have support for "integer only" as an option in the main Lua branch by for example using ifdefs in the C code.


This is extensive surgery, not particularly hard to do but boring and
error prone to do for each Lua release.

I wondered how far one would go by simply adding
        #define double long
at the top of luaconf.h and fixing a few library calls...

I did just that for Lua 5.3.1 and got just a few compilation errors,
mostly about LUA_NUMBER_FMT being wrong for long and for implicit
conversion of double values to long in lmathlib.c (which would really
need to be changed).

Bottom line: it seems to be straightforward to add support for
LUA_FLOAT_NONE in luaconf.h.

What am I missing?