MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / l_str2d

Function l_str2d

src/Chain/libraries/glua/lobject.cpp:246–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

244
245
246static 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
260static const char *l_str2int(const char *s, lua_Integer *result) {

Callers 1

luaO_str2numFunction · 0.85

Calls 1

lua_strx2numberFunction · 0.85

Tested by

no test coverage detected