|
@@ -72,7 +72,7 @@ class Array<T> {
|
|
|
public function slice( pos : Int, ?end : Int ) : Array<T> {
|
|
|
if (end == null || end > length) end = length;
|
|
|
else if (end < 0) end = length-(-end % length);
|
|
|
- if (pos < 0) pos = length -(-pos % length);
|
|
|
+ if (pos < 0) pos = (length -(-pos % length)) % length; // negative pos needs to be wrapped from the end, and mod according to array length
|
|
|
if (pos > end || pos > length) return [];
|
|
|
|
|
|
var ret = [];
|