** Try to convert a value to a float. The float case is already handled ** by the macro 'tonumber'. */
| 101 | ** by the macro 'tonumber'. |
| 102 | */ |
| 103 | int 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 | /* |
nothing calls this directly
no test coverage detected