@Override public double optdouble(double defval) { return checknumber().checkdouble(); }
public LuaInteger optinteger(LuaInteger defval) { return checknumber().checkinteger(); }
public long optlong(long defval) { return checknumber().checklong(); }
/** Concatenate this buffer onto a {@link LuaNumber} * <p> * The {@link LuaNumber} will be converted to a string before concatenating. * @param lhs the left-hand-side value onto which we are concatenating {@code this} * @return {@link Buffer} for use in call chaining. */ public Buffer concatTo(LuaNumber lhs) { return value!=null&&!value.isstring()? setvalue(lhs.concat(value)): prepend(lhs.strvalue()); }
/** Return argument i as a double, or throw an error if it cannot be converted to one. * @param i the index of the argument to test, 1 is the first argument * @return java double value if argument i is a number or string that converts to a number * @exception LuaError if the argument is not a number * */ public double checkdouble(int i) { return arg(i).checknumber().todouble(); }
private RedisToken convertLuaNumber(LuaNumber value) { return integer(value.toint()); }
public LuaNumber optnumber(LuaNumber defval) { return checknumber().checknumber(); }
@Override public int optint(int defval) { return checknumber().checkint(); }
/** Reverse-concatenation: concatenate this value onto another value * known to be a {@link LuaNumber} * and return the result using rules of lua string concatenation including * metatag processing. * <p> * Only strings and numbers as represented can be concatenated, meaning * each operand must derive from {@link LuaString} or {@link LuaNumber}. * * @param lhs The left-hand-side value onto which this will be concatenated * @return {@link LuaValue} resulting from concatenation of {@code (lhs .. this)} * @throws LuaError if either operand is not of an appropriate type, * such as nil or a table * @see #concat(LuaValue) */ public LuaValue concatTo(LuaNumber lhs) { return lhs.concatmt(this); }
/** Concatenate this buffer onto a {@link LuaNumber} * <p> * The {@link LuaNumber} will be converted to a string before concatenating. * @param lhs the left-hand-side value onto which we are concatenating {@code this} * @return {@link Buffer} for use in call chaining. */ public Buffer concatTo(LuaNumber lhs) { return value!=null&&!value.isstring()? setvalue(lhs.concat(value)): prepend(lhs.strvalue()); }
/** Return argument i as a double, or throw an error if it cannot be converted to one. * @param i the index of the argument to test, 1 is the first argument * @return java double value if argument i is a number or string that converts to a number * @exception LuaError if the argument is not a number * */ public double checkdouble(int i) { return arg(i).checknumber().todouble(); }
/** Return argument i as a java int value, discarding any fractional part, or throw an error if not a number. * @param i the index of the argument to test, 1 is the first argument * @return int value with fraction discarded and truncated if necessary if argument i is number * @exception LuaError if the argument is not a number * */ public int checkint(int i) { return arg(i).checknumber().toint(); }
public LuaNumber optnumber(LuaNumber defval) { return checknumber().checknumber(); }
public int optint(int defval) { return checknumber().checkint(); }
/** Reverse-concatenation: concatenate this value onto another value * known to be a {@link LuaNumber} * and return the result using rules of lua string concatenation including * metatag processing. * <p> * Only strings and numbers as represented can be concatenated, meaning * each operand must derive from {@link LuaString} or {@link LuaNumber}. * * @param lhs The left-hand-side value onto which this will be concatenated * @return {@link LuaValue} resulting from concatenation of {@code (lhs .. this)} * @throws LuaError if either operand is not of an appropriate type, * such as nil or a table * @see #concat(LuaValue) */ public LuaValue concatTo(LuaNumber lhs) { return lhs.concatmt(this); }
/** Concatenate this buffer onto a {@link LuaNumber} * <p> * The {@link LuaNumber} will be converted to a string before concatenating. * @param lhs the left-hand-side value onto which we are concatenating {@code this} * @return {@link Buffer} for use in call chaining. */ public Buffer concatTo(LuaNumber lhs) { return value!=null&&!value.isstring()? setvalue(lhs.concat(value)): prepend(lhs.strvalue()); }
/** Return argument i as a double, or throw an error if it cannot be converted to one. * @param i the index of the argument to test, 1 is the first argument * @return java double value if argument i is a number or string that converts to a number * @exception LuaError if the argument is not a number * */ public double checkdouble(int i) { return arg(i).checknumber().todouble(); }