| 244 | |
| 245 | |
| 246 | static const char *l_str2d(const char *s, lua_Number *result) { |
| 247 | char *endptr; |
| 248 | if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */ |
| 249 | return nullptr; |
| 250 | else if (strpbrk(s, "xX")) /* hex? */ |
| 251 | *result = lua_strx2number(s, &endptr); |
| 252 | else |
| 253 | *result = lua_str2number(s, &endptr); |
| 254 | if (endptr == s) return nullptr; /* nothing recognized */ |
| 255 | while (lisspace(cast_uchar(*endptr))) endptr++; |
| 256 | return (*endptr == '\0' ? endptr : nullptr); /* OK if no trailing characters */ |
| 257 | } |
| 258 | |
| 259 | |
| 260 | static const char *l_str2int(const char *s, lua_Integer *result) { |
no test coverage detected