/** Perform boolean {@code and} with another operand, based on lua rules for boolean evaluation. * This returns either {@code this} or {@code rhs} depending on the boolean value for {@code this}. * * @param rhs The right-hand-side value to perform the operation with * @return {@code this} if {@code this.toboolean()} is false, {@code rhs} otherwise. */ public LuaValue and( LuaValue rhs ) { return this.toboolean()? rhs: this; }
/** Perform boolean {@code or} with another operand, based on lua rules for boolean evaluation. * This returns either {@code this} or {@code rhs} depending on the boolean value for {@code this}. * * @param rhs The right-hand-side value to perform the operation with * @return {@code this} if {@code this.toboolean()} is true, {@code rhs} otherwise. */ public LuaValue or( LuaValue rhs ) { return this.toboolean()? this: rhs; }
/** Perform boolean {@code and} with another operand, based on lua rules for boolean evaluation. * This returns either {@code this} or {@code rhs} depending on the boolean value for {@code this}. * * @param rhs The right-hand-side value to perform the operation with * @return {@code this} if {@code this.toboolean()} is false, {@code rhs} otherwise. */ public LuaValue and( LuaValue rhs ) { return this.toboolean()? rhs: this; }
/** Perform boolean {@code or} with another operand, based on lua rules for boolean evaluation. * This returns either {@code this} or {@code rhs} depending on the boolean value for {@code this}. * * @param rhs The right-hand-side value to perform the operation with * @return {@code this} if {@code this.toboolean()} is true, {@code rhs} otherwise. */ public LuaValue or( LuaValue rhs ) { return this.toboolean()? this: rhs; }
public Object coerce(LuaValue value) { return value.toboolean()? Boolean.TRUE: Boolean.FALSE; } }
/** Perform boolean {@code or} with another operand, based on lua rules for boolean evaluation. * This returns either {@code this} or {@code rhs} depending on the boolean value for {@code this}. * * @param rhs The right-hand-side value to perform the operation with * @return {@code this} if {@code this.toboolean()} is true, {@code rhs} otherwise. */ public LuaValue or( LuaValue rhs ) { return this.toboolean()? this: rhs; }
/** Perform boolean {@code and} with another operand, based on lua rules for boolean evaluation. * This returns either {@code this} or {@code rhs} depending on the boolean value for {@code this}. * * @param rhs The right-hand-side value to perform the operation with * @return {@code this} if {@code this.toboolean()} is false, {@code rhs} otherwise. */ public LuaValue and( LuaValue rhs ) { return this.toboolean()? rhs: this; }
public Object coerce(LuaValue value) { return value.toboolean()? Boolean.TRUE: Boolean.FALSE; } }
/** Convert argument {@code i} to java boolean based on lua rules for boolean evaluation. * @param i the index of the argument to convert, 1 is the first argument * @return {@code false} if argument i is nil or false, otherwise {@code true} * */ public boolean toboolean(int i) { return arg(i).toboolean(); }
/** Convert argument {@code i} to java boolean based on lua rules for boolean evaluation. * @param i the index of the argument to convert, 1 is the first argument * @return {@code false} if argument i is nil or false, otherwise {@code true} * */ public boolean toboolean(int i) { return arg(i).toboolean(); }
/** Convert argument {@code i} to java boolean based on lua rules for boolean evaluation. * @param i the index of the argument to convert, 1 is the first argument * @return {@code false} if argument i is nil or false, otherwise {@code true} * */ public boolean toboolean(int i) { return arg(i).toboolean(); }
public boolean getBoolean(String name) { return env.get(name).toboolean(); }
public LuaValue len() { final LuaValue h = metatag(LEN); if (h.toboolean()) return h.call(this); return LuaInteger.valueOf(rawlen()); }
public Varargs invoke(Varargs args) { if ( !args.arg1().toboolean() ) error( args.narg()>1? args.optjstring(2,"assertion failed!"): "assertion failed!" ); return args; } }
public LuaValue len() { final LuaValue h = metatag(LEN); if (h.toboolean()) return h.call(this); return LuaInteger.valueOf(rawlen()); }
public Varargs invoke(Varargs args) { if (!args.arg1().toboolean()) { error(args.narg() > 1 ? args.optjstring(2, "assertion failed!") : "assertion " + "failed!"); } return args; } }
@Override public Varargs invoke(Varargs args) { if ( !args.arg1().toboolean() ) error( args.narg()>1? args.optjstring(2,"assertion failed!"): "assertion failed!" ); return args; } }
private void println(LuaValue value) { System.out.println(value.tojstring()); System.out.println(value.toboolean()); System.out.println(value.toint()); System.out.println(value.todouble()); System.out.println(value.tofloat()); } }
public Varargs invoke(Varargs args) { final Varargs result = luathread.resume(args); if ( result.arg1().toboolean() ) { return result.subargs(2); } else { return error( result.arg(2).tojstring() ); } } }
public Varargs invoke(Varargs args) { final Varargs result = luathread.resume(args); if ( result.arg1().toboolean() ) { return result.subargs(2); } else { return error( result.arg(2).tojstring() ); } } }