Why should functions be different in different compilers ... why?
Well, the problem was that Lua was trying to convert numbers to double by default. To do this, use the strtod function, which takes 2 arguments, a string and a char pointer. The char pointer must point to the last position after the parsed number. Which for a hexadecimal number would mean "x", after "0". If this is not the case, Lua accepts the error and gives us this small little error message.
I compiled Lua using DMC because I need the lib to be in OMF, and I suppose others used DMC. But obviously DMC strtod works differently, since pointers always point to the beginning of a line if it is hexadecimal ... or rather an invalid number.
Now I have added a little hack that checks x if conversion to double fails. Not very, but at the moment everything is fine.
int luaO_str2d (const char *s, lua_Number *result) { char *endptr; *result = lua_str2number(s, &endptr); if (endptr == s) if(*(s+1) == 'x' || *(s+1) == 'X') endptr++; else return 0;
source share