/** * Evaluates the Lua expression {@code a == b}, including the handling of metamethods, * and stores the result to the return buffer associated with {@code context}. * <b>This method throws an {@link UnresolvedControlThrowable}</b>: non-local control * changes are expected to be resolved by the caller of this method. * * @param context execution context, must not be {@code null} * @param a the first operand, may be any value * @param b the second operand, may be any value * * @throws UnresolvedControlThrowable if the evaluation called a metamethod and the metamethod * initiates a non-local control change * @throws NullPointerException if {@code context} is {@code null} */ @SuppressWarnings("unused") public static void eq(ExecutionContext context, Object a, Object b) throws UnresolvedControlThrowable { eq(context, true, a, b); }
/** * Evaluates the Lua expression {@code a != b}, including the handling of metamethods, * and stores the result to the return buffer associated with {@code context}. * <b>This method throws an {@link UnresolvedControlThrowable}</b>: non-local control * changes are expected to be resolved by the caller of this method. * * @param context execution context, must not be {@code null} * @param a the first operand, may be any value * @param b the second operand, may be any value * * @throws UnresolvedControlThrowable if the evaluation called a metamethod and the metamethod * initiates a non-local control change * @throws NullPointerException if {@code context} is {@code null} */ @SuppressWarnings("unused") public static void neq(ExecutionContext context, Object a, Object b) throws UnresolvedControlThrowable { eq(context, false, a, b); }
/** * Returns {@code true} iff {@code a} <i>op</i> {@code b}, where <i>op</i> is * "{@code <=}" (lesser than or equal to) if {@code sign > 0}, or "{@code >=}" (greater * than or equal to) if {@code sign < 0}. * * <p>When {@code sign} is zero or <i>NaN</i>, returns {@code false}.</p> * * @param a the first operand, must not be {@code null} * @param b the second operand, must not be {@code null} * @param sign the sign, must not be {@code null} * * @return {@code true} iff {@code a} is below {@code b} depending on the sign * of {@code sign} * * @throws NullPointerException if {@code a}, {@code b} or {@code sign} is {@code null} */ @SuppressWarnings("unused") public static boolean signed_le(Number a, Number b, Number sign) { return !eq(ZERO, sign) && (lt(ZERO, sign) ? le(a, b) : le(b, a)); }