Fix a bug printing floats
This commit is contained in:
@@ -14,9 +14,16 @@ void atomic_print(LuaStack &LS, LuaSlot val, std::ostream *os) {
|
||||
// TODO: this could be more efficient.
|
||||
(*os) << LS.ckstring(val);
|
||||
return;
|
||||
case LUA_TNUMBER:
|
||||
(*os) << LS.ckinteger(val);
|
||||
case LUA_TNUMBER: {
|
||||
double value = LS.cknumber(val);
|
||||
int64_t ivalue = int64_t(value);
|
||||
if (double(ivalue) == value) {
|
||||
(*os) << ivalue;
|
||||
} else {
|
||||
(*os) << value;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case LUA_TBOOLEAN:
|
||||
(*os) << (LS.ckboolean(val) ? "true" : "false");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user