MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / luaO_str2d

Function luaO_str2d

deps/lua/src/lobject.c:90–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88
89
90int 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

Callers 3

luaV_tonumberFunction · 0.85
trydecpointFunction · 0.85
read_numeralFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected