lua-users home
lua-l archive

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


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