You can switch to LuaJIT. It formats numbers consistently between platforms.
From the extensions page:
tostring() etc. canonicalize NaN and ±Inf
All number-to-string conversions consistently convert non-finite numbers to the same strings on all platforms. NaN results in “nan”, positive infinity results in “inf” and negative infinity results in “-inf”.
tonumber() etc. use builtin string to number conversion
All string-to-number conversions consistently convert integer and floating-point inputs in decimal and hexadecimal on all platforms. strtod() is not used anymore, which avoids numerous problems with poor C library implementations. The builtin conversion function provides full precision according to the IEEE-754 standard, it works independently of the current locale and it supports hex floating-point numbers (e.g. 0x1.5p-3).