private int capture_to_close() { int level = this.level; for ( level--; level >= 0; level-- ) if ( clen[level] == CAP_UNFINISHED ) return level; error("invalid pattern capture"); return 0; }
private int check_capture( int l ) { l -= '1'; if ( l < 0 || l >= level || this.clen[l] == CAP_UNFINISHED ) { error("invalid capture index"); } return l; }
private int check_capture( int l ) { l -= '1'; if ( l < 0 || l >= level || this.clen[l] == CAP_UNFINISHED ) { error("invalid capture index"); } return l; }
private int capture_to_close() { int level = this.level; for ( level--; level >= 0; level-- ) if ( clen[level] == CAP_UNFINISHED ) return level; error("invalid pattern capture"); return 0; }
private int capture_to_close() { int level = this.level; for ( level--; level >= 0; level-- ) if ( clen[level] == CAP_UNFINISHED ) return level; error("invalid pattern capture"); return 0; }
private int check_capture( int l ) { l -= '1'; if ( l < 0 || l >= level || this.clen[l] == CAP_UNFINISHED ) { error("invalid capture index"); } return l; }
/** 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 {@link LuaError} indicating index was attempted on illegal type * @throws LuaError when called. */ private void indexerror() { error( "attempt to index ? (a "+typename()+" value)" ); }
/** Throw {@link LuaError} indicating index was attempted on illegal type * @throws LuaError when called. */ private void indexerror() { error( "attempt to index ? (a "+typename()+" value)" ); }
/** 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; }
/** 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 * @returns 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 {@link LuaError} indicating index was attempted on illegal type * @throws LuaError when called. */ private void indexerror() { error( "attempt to index ? (a "+typename()+" value)" ); }
/** 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 * @returns 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; }
public Varargs invoke(Varargs args) { Object[] a = convertArgs(args); try { return CoerceJavaToLua.coerce( constructor.newInstance(a) ); } catch (InvocationTargetException e) { throw new LuaError(e.getTargetException()); } catch (Exception e) { return LuaValue.error("coercion error "+e); } }
LuaValue invokeMethod(Object instance, Varargs args) { Object[] a = convertArgs(args); try { return CoerceJavaToLua.coerce( method.invoke(instance, a) ); } catch (InvocationTargetException e) { throw new LuaError(e.getTargetException()); } catch (Exception e) { return LuaValue.error("coercion error "+e); } }
public Varargs invoke(Varargs args) { Object[] a = convertArgs(args); try { return CoerceJavaToLua.coerce( constructor.newInstance(a) ); } catch (InvocationTargetException e) { throw new LuaError(e.getTargetException()); } catch (Exception e) { return LuaValue.error("coercion error "+e); } }
LuaValue invokeMethod(Object instance, Varargs args) { Object[] a = convertArgs(args); try { return CoerceJavaToLua.coerce( method.invoke(instance, a) ); } catch (InvocationTargetException e) { throw new LuaError(e.getTargetException()); } catch (Exception e) { return LuaValue.error("coercion error "+e); } }
@Override public LuaValue call(LuaValue arg) { if (arg.isnil()) { return LuaValue.error("bad argument #1 to 'getn' (table expected, got nil)"); } else { return arg.checktable().len(); } } });