print prints floating point with a comma

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Nikki
Citizen
Posts: 83
Joined: Wed Jan 25, 2017 5:42 pm

print prints floating point with a comma

Post by Nikki »

Hi there, i have a new mac mini running big sur,

I pinpointed some issues i have to the following weirdness:

on my old machine

Code: Select all

print(1.123)
prints

Code: Select all

1.123
on the new machine it results in

Code: Select all

1,123
I dont understand why and its causing issues down the line, for example with string.format and tonumber()

It could be that there is something deeper even, because without print() the issue is there too, for example

Code: Select all

tonumber(string.format("%.3f", 1.123456))
this suddenly returns nil, where it should or did return 1.123

anyone know what todo about it ?
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: print prints floating point with a comma

Post by grump »

What does

Code: Select all

os.setlocale(nil)
return?

If it's something other than "C", try

Code: Select all

os.setlocale("C")
to switch to the standard C locale. This should fix the issue.
User avatar
Nikki
Citizen
Posts: 83
Joined: Wed Jan 25, 2017 5:42 pm

Re: print prints floating point with a comma

Post by Nikki »

yes this fixed it, thx!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], pgimeno and 47 guests