1 | initial version |
This should work on both PCs, with either English or German locale.
By resetting the locale to the default ("C"), thus with a dot as decimal symbol.
assert(os.setlocale'C')
local a = "-15.687"
local b = tonumber(a)
print("a " .. a)
print("b " .. b)
The opposite is also possible. By setting os.setlocale'de_DE'
the decimal symbol is set to comma (among other regional settings).