MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / luaV_tonumber_

Function luaV_tonumber_

third-party/lua-5.5.0/src/lvm.c:108–120  ·  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

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

Callers

nothing calls this directly

Calls 1

l_strtonFunction · 0.70

Tested by

no test coverage detected