Fixed annoying lua bug where number formating was broken (outputed 'g')

develop
Warmist 2011-08-20 01:11:49 +03:00
parent 68fbd4a78d
commit fc745f70ae
1 changed files with 4 additions and 0 deletions

@ -520,7 +520,11 @@
*/ */
#define LUA_NUMBER_SCAN "%lf" #define LUA_NUMBER_SCAN "%lf"
#define LUA_NUMBER_FMT "%.14g" #define LUA_NUMBER_FMT "%.14g"
#ifdef WIN32 //More specifically MSVC, but did not work, either way only MSVC is used in windows build
#define lua_number2str(s,n) sprintf_s((s),32, LUA_NUMBER_FMT, (n))
#else
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) #define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
#endif
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */ #define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
#define lua_str2number(s,p) strtod((s), (p)) #define lua_str2number(s,p) strtod((s), (p))