mirror of https://github.com/yt-dlp/yt-dlp
[swfinterp] Correct array access
parent
0d989011ff
commit
decf2ae400
@ -0,0 +1,19 @@
|
|||||||
|
// input: [["a", "b", "c", "d"]]
|
||||||
|
// output: ["c", "b", "a", "d"]
|
||||||
|
|
||||||
|
package {
|
||||||
|
public class ArrayAccess {
|
||||||
|
public static function main(ar:Array):Array {
|
||||||
|
var aa:ArrayAccess = new ArrayAccess();
|
||||||
|
return aa.f(ar, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function f(ar:Array, num:Number):Array{
|
||||||
|
var x:String = ar[0];
|
||||||
|
var y:String = ar[num % ar.length];
|
||||||
|
ar[0] = y;
|
||||||
|
ar[num] = x;
|
||||||
|
return ar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue