MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaV_tonumber_

Function luaV_tonumber_

extlibs/lua/src/lvm.c:103–115  ·  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

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

Callers

nothing calls this directly

Calls 1

l_strtonFunction · 0.85

Tested by

no test coverage detected