/** 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 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 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 String replace(String msg, LuaTable params) { for (int i=1; i<params.length()+1; i++) { LuaValue param = params.get(i); String actualParam; if (param.istable()) { if (!param.get("raw").isnil()) { actualParam = param.get("raw").checkjstring(); } else if (!param.get("num").isnil()) { if (param.get("num").isnumber()) { LuaNumber number = param.get("num").checknumber(); NumberFormat nf = NumberFormat.getInstance(Locale.forLanguageTag(lang)); actualParam = nf.format(number.todouble()); } else { actualParam = param.get("num").tojstring(); } } else { actualParam = "unknown"; } } else { actualParam = param.checkjstring(); } msg = msg.replace("$"+i, actualParam); } return msg; } }