| 100 | |
| 101 | |
| 102 | int luaO_str2d (const char *s, lua_Number *result) { |
| 103 | char *endptr; |
| 104 | *result = lua_str2number(s, &endptr); |
| 105 | if (endptr == s) return 0; /* conversion failed */ |
| 106 | if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */ |
| 107 | *result = cast_num(strtoul(s, &endptr, 16)); |
| 108 | if (*endptr == '\0') return 1; /* most common case */ |
| 109 | while (isspace(cast(unsigned char, *endptr))) endptr++; |
| 110 | if (*endptr != '\0') return 0; /* invalid trailing characters? */ |
| 111 | return 1; |
| 112 | } |
| 113 | |
| 114 | |
| 115 | static void pushstr (lua_State *L, const char *str) { |
no outgoing calls
no test coverage detected