135136137138139140141142143144145
n = (int)(pose - posi + 1); if (posi + n <= pose) /* overflow? */ error("string slice too long"); LuaValue[] v = new LuaValue[n]; for (i=0; i<n; i++) v[i] = valueOf(s.luaByte(posi+i-1)); return varargsOf(v); } /** * string.char (...)
232233234235236237238239240241242
Buffer result = new Buffer(n); int arg = 1; int c; for ( int i = 0; i < n; ) { switch ( c = fmt.luaByte( i++ ) ) { case '\n': result.append( "\n" ); break; default: result.append( (byte) c );
241242243244245246247248249250251
default: result.append( (byte) c ); break; case L_ESC: if ( i < n ) { if ( ( c = fmt.luaByte( i ) ) == L_ESC ) { ++i; result.append( (byte)L_ESC ); } else { arg++; FormatDesc fdsc = new FormatDesc(args, fmt, i );
664665666667668669670671672673674
static LuaValue reverse( LuaValue arg ) { LuaString s = arg.checkstring(); int n = s.length(); byte[] b = new byte[n]; for ( int i=0, j=n-1; i<n; i++, j-- ) b[j] = (byte) s.luaByte(i); return LuaString.valueOf( b ); } /** * string.sub (s, i [, j])
735736737738739740741742743744745
} else { MatchState ms = new MatchState( args, s, pat ); boolean anchor = false; int poff = 0; if ( pat.luaByte( 0 ) == '^' ) { anchor = true; poff = 1; } int soff = init;