In lua all numbers are strings, but not all strings are numbers. This function will return the {@link LuaValue} {@code this} if it is a number or a string convertible to a number, and {@link NIL} for all other cases.
This allows values to be tested for their "numeric-ness" without the penalty of throwing exceptions, nor the cost of converting the type and creating storage for it. @return {@code this} if it is a {@link LuaNumber}or {@link LuaString} that can be converted to a number, otherwise {@link #NIL} @see #tostring() @see #optnumber(LuaNumber) @see #checknumber() @see #toint() @see #todouble()
|
|
|
|