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