public Varargs invoke(Varargs args) { LuaValue func = args.checkfunction(1); int up = args.checkint(2); if ( func instanceof LuaClosure ) { LuaClosure c = (LuaClosure) func; if ( c.upValues != null && up > 0 && up <= c.upValues.length ) { return valueOf(c.upValues[up-1].hashCode()); } } return NIL; } }
public Varargs invoke(Varargs args) { LuaValue func = args.checkfunction(1); int up = args.checkint(2); if ( func instanceof LuaClosure ) { LuaClosure c = (LuaClosure) func; if ( c.upValues != null && up > 0 && up <= c.upValues.length ) { return valueOf(c.upValues[up-1].hashCode()); } } return NIL; } }
static Varargs btest( Varargs args ) { int bits = -1; for ( int i = 1; i <= args.narg(); i++ ) { bits &= args.checkint(i); } return valueOf( bits != 0 ); }
static Varargs band( Varargs args ) { int result = -1; for ( int i = 1; i <= args.narg(); i++ ) { result &= args.checkint(i); } return bitsToValue( result ); }
static Varargs btest( Varargs args ) { int bits = -1; for ( int i = 1; i <= args.narg(); i++ ) { bits &= args.checkint(i); } return valueOf( bits != 0 ); }
static Varargs band( Varargs args ) { int result = -1; for ( int i = 1; i <= args.narg(); i++ ) { result &= args.checkint(i); } return bitsToValue( result ); }
static Varargs bor( Varargs args ) { int result = 0; for ( int i = 1; i <= args.narg(); i++ ) { result |= args.checkint(i); } return bitsToValue( result ); }
static Varargs bxor( Varargs args ) { int result = 0; for ( int i = 1; i <= args.narg(); i++ ) { result ^= args.checkint(i); } return bitsToValue( result ); }
static Varargs bxor( Varargs args ) { int result = 0; for ( int i = 1; i <= args.narg(); i++ ) { result ^= args.checkint(i); } return bitsToValue( result ); }
static Varargs bor( Varargs args ) { int result = 0; for ( int i = 1; i <= args.narg(); i++ ) { result |= args.checkint(i); } return bitsToValue( result ); }
public Varargs invoke(Varargs args) { int n = args.narg(); byte[] bytes = new byte[n]; for ( int i=0, a=1; i<n; i++, a++ ) { int c = args.checkint(a); if (c<0 || c>=256) argerror(a, "invalid value"); bytes[i] = (byte) c; } return LuaString.valueUsing( bytes ); } }
public Varargs invoke(Varargs args) { int a=1; LuaThread thread = args.isthread(a)? args.checkthread(a++): globals.running; int level = args.checkint(a++); int local = args.checkint(a++); LuaValue value = args.arg(a++); CallFrame f = callstack(thread).getCallFrame(level); return f != null? f.setLocal(local, value): NONE; } }
public Varargs invoke(Varargs args) { LuaString s = args.checkstring( 1 ); int n = args.checkint( 2 ); final byte[] bytes = new byte[ s.length() * n ]; int len = s.length(); for ( int offset = 0; offset < bytes.length; offset += len ) { s.copyInto( 0, bytes, offset, len ); } return LuaString.valueUsing( bytes ); } }
public Varargs invoke(Varargs args) { LuaString s = args.checkstring( 1 ); int n = args.checkint( 2 ); final byte[] bytes = new byte[ s.length() * n ]; int len = s.length(); for ( int offset = 0; offset < bytes.length; offset += len ) { s.copyInto( 0, bytes, offset, len ); } return LuaString.valueUsing( bytes ); } }
public Varargs invoke(Varargs args) { int n = args.narg()-1; if ( args.arg1().equals(valueOf("#")) ) return valueOf(n); int i = args.checkint(1); if ( i == 0 || i < -n ) argerror(1,"index out of range"); return args.subargs(i<0? n+i+2: i+1); } }