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