/** Convert to human readable String for any type. * @return String for use by human readers based on type. * @see #tostring() * @see #optjstring(String) * @see #checkjstring() * @see #isstring() * @see #TSTRING */ public String tojstring() { return typename() + ": " + Integer.toHexString(hashCode()); }
/** * Throw a {@link LuaError} based on a comparison error such as greater-than or less-than, * typically due to an invalid operand type * @param rhs Right-hand-side of the comparison that resulted in the error. * @throws LuaError in all cases */ protected LuaValue compareerror(LuaValue rhs) { throw new LuaError("attempt to compare "+typename()+" with "+rhs.typename()); }
/** Convert to human readable String for any type. * @return String for use by human readers based on type. * @see #tostring() * @see #optjstring(String) * @see #checkjstring() * @see #isstring() * @see #TSTRING */ public String tojstring() { return typename() + ": " + Integer.toHexString(hashCode()); }
/** * Throw a {@link LuaError} based on a comparison error such as greater-than or less-than, * typically due to an invalid operand type * @param rhs Right-hand-side of the comparison that resulted in the error. * @throws LuaError in all cases */ protected LuaValue compareerror(LuaValue rhs) { throw new LuaError("attempt to compare "+typename()+" with "+rhs.typename()); }
/** * Throw a {@link LuaError} based on a comparison error such as greater-than or less-than, * typically due to an invalid operand type * @param rhs String description of what was on the right-hand-side of the comparison that resulted in the error. * @throws LuaError in all cases */ protected LuaValue compareerror(String rhs) { throw new LuaError("attempt to compare "+typename()+" with "+rhs); }
/** Perform string comparison with another value * of any type * using string comparison based on byte values. * <p> * Only strings can be compared, meaning * each operand must derive from {@link LuaString}. * * @param rhs The right-hand-side value to perform the comparison with * @return int < 0 for {@code (this < rhs)}, int > 0 for {@code (this > rhs)}, or 0 when same string. * @throws LuaError if either operand is not a string */ public int strcmp( LuaValue rhs ) { error("attempt to compare "+typename()); return 0; }
/** * Throw a {@link LuaError} based on an arithmetic error such as add, or pow, * typically due to an invalid operand type * @param fun String description of the function that was attempted * @throws LuaError in all cases */ protected LuaValue aritherror(String fun) { throw new LuaError("attempt to perform arithmetic '"+fun+"' on "+typename()); }
/** * Throw a {@link LuaError} indicating an invalid argument was supplied to a function * @param expected String naming the type that was expected * @throws LuaError in all cases */ protected LuaValue argerror(String expected) { throw new LuaError("bad argument: "+expected+" expected, got "+typename()); }
/** Throw {@link LuaError} indicating index was attempted on illegal type * @throws LuaError when called. */ private void indexerror() { error( "attempt to index ? (a "+typename()+" value)" ); }
/** * Throw a {@link LuaError} based on an arithmetic error such as add, or pow, * typically due to an invalid operand type * @param fun String description of the function that was attempted * @throws LuaError in all cases */ protected LuaValue aritherror(String fun) { throw new LuaError("attempt to perform arithmetic '"+fun+"' on "+typename()); }
/** * Throw a {@link LuaError} indicating an invalid type was supplied to a function * @param expected String naming the type that was expected * @throws LuaError in all cases */ protected LuaValue typerror(String expected) { throw new LuaError(expected+" expected, got "+typename()); }
/** * Throw a {@link LuaError} indicating an operation is not implemented * @throws LuaError in all cases */ protected LuaValue unimplemented(String fun) { throw new LuaError("'"+fun+"' not implemented for "+typename()); }
/** * Throw a {@link LuaError} based on a comparison error such as greater-than or less-than, * typically due to an invalid operand type * @param rhs String description of what was on the right-hand-side of the comparison that resulted in the error. * @throws LuaError in all cases */ protected LuaValue compareerror(String rhs) { throw new LuaError("attempt to compare "+typename()+" with "+rhs); }
/** Perform string comparison with another value * of any type * using string comparison based on byte values. * <p> * Only strings can be compared, meaning * each operand must derive from {@link LuaString}. * * @param rhs The right-hand-side value to perform the comparison with * @return int < 0 for {@code (this < rhs)}, int > 0 for {@code (this > rhs)}, or 0 when same string. * @throws LuaError if either operand is not a string */ public int strcmp( LuaValue rhs ) { error("attempt to compare "+typename()); return 0; }
/** Perform string comparison with another value * known to be a {@link LuaString} * using string comparison based on byte values. * <p> * Only strings can be compared, meaning * each operand must derive from {@link LuaString}. * * @param rhs The right-hand-side value to perform the comparison with * @return int < 0 for {@code (this < rhs)}, int > 0 for {@code (this > rhs)}, or 0 when same string. * @throws LuaError if this is not a string */ public int strcmp( LuaString rhs ) { error("attempt to compare "+typename()); return 0; }
/** * Throw a {@link LuaError} based on the len operator, * typically due to an invalid operand type * @throws LuaError in all cases */ protected LuaValue lenerror() { throw new LuaError("attempt to get length of "+typename()); }
/** Perform string comparison with another value * known to be a {@link LuaString} * using string comparison based on byte values. * <p> * Only strings can be compared, meaning * each operand must derive from {@link LuaString}. * * @param rhs The right-hand-side value to perform the comparison with * @return int < 0 for {@code (this < rhs)}, int > 0 for {@code (this > rhs)}, or 0 when same string. * @throws LuaError if this is not a string */ public int strcmp( LuaString rhs ) { error("attempt to compare "+typename()); return 0; }
@Override public LuaValue call(LuaValue arg) { Log.i(TAG, "Log " + packageName + ":" + uid + " " + hook + " " + arg.toString() + " (" + arg.typename() + ")"); return LuaValue.NIL; } }
/** * Throw a {@link LuaError} indicating an invalid type was supplied to a function * @param expected String naming the type that was expected * @throws LuaError in all cases */ protected LuaValue typerror(String expected) { throw new LuaError(expected+" expected, got "+typename()+" value="+this.tostring()); }
/** * Throw a {@link LuaError} indicating an invalid argument was supplied to a function * @param expected String naming the type that was expected * @throws LuaError in all cases */ protected LuaValue argerror(String expected) { throw new LuaError("bad argument: "+expected+" expected, got "+typename()+" value="+this.tostring()); }