/** Tests if argument i is a string. * Since all lua numbers can be used where strings are used, * this will return true for both strings and numbers. * @param i the index of the argument to test, 1 is the first argument * @return true if the argument exists and is a string or number, false otherwise * @see LuaValue#TNUMBER * @see LuaValue#TSTRING * */ public boolean isstring(int i) { return arg(i).isstring(); }
/** Tests if argument i is a string. * Since all lua numbers can be used where strings are used, * this will return true for both strings and numbers. * @param i the index of the argument to test, 1 is the first argument * @return true if the argument exists and is a string or number, false otherwise * @see LuaValue#TNUMBER * @see LuaValue#TSTRING * */ public boolean isstring(int i) { return arg(i).isstring(); }
@Override public LuaValue call(LuaValue arg) { if (arg.isstring()) { String uri = arg.tojstring(); Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); sandBoxContext.getAndroidContext().startActivity(i); } return LuaValue.NIL; } });
/** Concatenate this buffer onto a {@link LuaString} * @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(LuaString lhs) { return value!=null&&!value.isstring()? setvalue(lhs.concat(value)): prepend(lhs); }
/** Concatenate this buffer onto a {@link LuaString} * @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(LuaString lhs) { return value!=null&&!value.isstring()? setvalue(lhs.concat(value)): prepend(lhs); }
/** Concatenate this buffer onto a {@link LuaString} * @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(LuaString lhs) { return value!=null&&!value.isstring()? setvalue(lhs.concat(value)): prepend(lhs); }
static LuaString kname(Prototype p, int c) { if (Lua.ISK(c) && p.k[Lua.INDEXK(c)].isstring()) return p.k[Lua.INDEXK(c)].strvalue(); else return QMARK; }
static LuaString kname(Prototype p, int c) { if (Lua.ISK(c) && p.k[Lua.INDEXK(c)].isstring()) return p.k[Lua.INDEXK(c)].strvalue(); else return QMARK; }
public Varargs invoke(Varargs args) { LuaValue ld = args.arg1(); args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function"); String source = args.optjstring(2, ld.isstring()? ld.tojstring(): "=(load)"); String mode = args.optjstring(3, "bt"); LuaValue env = args.optvalue(4, globals); return loadStream(ld.isstring()? ld.strvalue().toInputStream(): new StringInputStream(ld.checkfunction()), source, mode, env); } }
/** 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()); }
static LuaString kname(Prototype p, int c) { if (Lua.ISK(c) && p.k[Lua.INDEXK(c)].isstring()) return p.k[Lua.INDEXK(c)].strvalue(); else return QMARK; }
public Varargs invoke(Varargs args) { LuaValue ld = args.arg1(); args.argcheck(ld.isstring() || ld.isfunction(), 1, "ld must be string or function"); String source = args.optjstring(2, ld.isstring() ? ld.tojstring() : "=(load)"); String mode = args.optjstring(3, "bt"); LuaValue env = args.optvalue(4, globals); return loadStream(ld.isstring() ? ld.strvalue().toInputStream() : new StringInputStream(ld.checkfunction()), source, mode, env); } }
/** 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()); }
/** 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()); }
public Varargs _io_input(LuaValue file) { infile = file.isnil()? input(): file.isstring()? ioopenfile(FTYPE_NAMED, file.checkjstring(),"r"): checkfile(file); return infile; }
public Varargs _io_output(LuaValue filename) { outfile = filename.isnil()? output(): filename.isstring()? ioopenfile(FTYPE_NAMED, filename.checkjstring(),"w"): checkfile(filename); return outfile; }
public Varargs _io_input(LuaValue file) { infile = file.isnil()? input(): file.isstring()? ioopenfile(FTYPE_NAMED, file.checkjstring(),"r"): checkfile(file); return infile; }
public Varargs _io_output(LuaValue filename) { outfile = filename.isnil()? output(): filename.isstring()? ioopenfile(FTYPE_NAMED, filename.checkjstring(),"w"): checkfile(filename); return outfile; }
public LuaValue call(LuaValue arg1, LuaValue arg2) { throw arg1.isnil() ? new LuaError(null, arg2.optint(1)) : arg1.isstring() ? new LuaError(arg1.tojstring(), arg2.optint(1)) : new LuaError(arg1); } }
public LuaValue call(LuaValue arg1, LuaValue arg2) { throw arg1.isnil()? new LuaError(null, arg2.optint(1)): arg1.isstring()? new LuaError(arg1.tojstring(), arg2.optint(1)): new LuaError(arg1); } }