MCPcopy Create free account
hub / github.com/Overload-Technologies/Overload / luaV_tonumber_

Function luaV_tonumber_

Dependencies/lua/src/lvm.c:105–117  ·  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

103** by the macro 'tonumber'.
104*/
105int luaV_tonumber_ (const TValue *obj, lua_Number *n) {
106 TValue v;
107 if (ttisinteger(obj)) {
108 *n = cast_num(ivalue(obj));
109 return 1;
110 }
111 else if (l_strton(obj, &v)) { /* string coercible to number? */
112 *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */
113 return 1;
114 }
115 else
116 return 0; /* conversion failed */
117}
118
119
120/*

Callers

nothing calls this directly

Calls 1

l_strtonFunction · 0.85

Tested by

no test coverage detected