[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: integer Lua 4.0
- From: Reuben Thomas <rrt1001@...>
- Date: Thu, 9 Nov 2000 10:39:48 +0000 (GMT)
> I should have gone through the code and changed all doubles (there are a few;
> they occur in lua.h, lapi.c, lauxlib.h, liolib.c, lmathlib.c).
So presumably you can change all the doubles which are really LUA_NUM_TYPE
to LUA_NUM_TYPE in the code.
> < if (fscanf(f, "%lf", &d) == 1) {
> ---
> > if (fscanf(f, "%ld", &d) == 1) {
> 448c448
> < status = status && fprintf(f, "%.16g", lua_tonumber(L, arg)) > 0;
> ---
> > status = status && fprintf(f, "%ld", lua_tonumber(L, arg)) > 0;
Looks like a couple of #defines are needed here, one for each format.
> < #define lua_str2number(s,p) strtod((s), (p))
> ---
> > #define lua_str2number(s,p) strtol((s), (p), 10)
...and another one here, perhaps using a new symbol LUA_NUM_TYPE_IS_INTEGRAL
to decide which one to use.
I hope that in 4.1 this can be formalised, so you really can change Lua to
integer use just by changing LUA_NUM_TYPE (and perhaps my suggested
LUA_NUM_TYPE_IS_INTEGRAL).
--
http://sc3d.org/rrt/ | certain, a. insufficiently analysed