[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Problem with string.format in lua 5.0 & 5.1
- From: Roberto Ierusalimschy <roberto@...>
- Date: Wed, 14 Dec 2005 12:20:24 -0200
I believe there are two problems mixed in your message. The first is
that str_format believes that lua_Number is double. So we actually need
the cast to double in the cases eEfgG.
The second is the integer conversions. In that case, str_format does not
typecast lua_Numbers impropertly. Cases ouxXd demand an int argument,
and this is what Lua provides. The problem here is that Lua provides
only these formats; it has nothing to do with lua_Number being double or
not. (Actually an integer as a a double has more than 32 bits, so it
will be truncated too.)
Formats %I64x or %I64d are not standard, but neither are %llx or %lld
in C89 (ll is standard in C99 however). Probably we could add some
configuration to these formats (a prefix, like "I64" or "ll", and
an integer type, like long long).
-- Roberto