MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / luaO_str2d

Function luaO_str2d

other_src/lua/src/lobject.cpp: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.70
trydecpointFunction · 0.70
read_numeralFunction · 0.70

Calls 1

ifFunction · 0.50

Tested by

no test coverage detected