| 88 | |
| 89 | |
| 90 | int luaO_str2d (const char *s, lua_Number *result) { |
| 91 | char *endptr; |
| 92 | *result = lua_str2number(s, &endptr); |
| 93 | if (endptr == s) return 0; /* conversion failed */ |
| 94 | if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ |
| 95 | *result = cast_num(strtoul(s, &endptr, 16)); |
| 96 | if (*endptr == '\0') return 1; /* most common case */ |
| 97 | while (isspace(cast(unsigned char, *endptr))) endptr++; |
| 98 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ |
| 99 | return 1; |
| 100 | } |
| 101 | |
| 102 | |
| 103 |
no outgoing calls
no test coverage detected