MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaV_tonumber_

Function luaV_tonumber_

lib/lua/src/lvm.c:115–127  ·  view source on GitHub ↗

** Try to convert a value to a float. The float case is already handled ** by the macro 'tonumber'. */

Source from the content-addressed store, hash-verified

113** by the macro 'tonumber'.
114*/
115int luaV_tonumber_ (const TValue *obj, lua_Number *n) {
116 TValue v;
117 if (ttisinteger(obj)) {
118 *n = cast_num(ivalue(obj));
119 return 1;
120 }
121 else if (l_strton(obj, &v)) { /* string coercible to number? */
122 *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */
123 return 1;
124 }
125 else
126 return 0; /* conversion failed */
127}
128
129
130/*

Callers

nothing calls this directly

Calls 1

l_strtonFunction · 0.85

Tested by

no test coverage detected