Skip to content

Make PoolByteArray and Array slice methods' end indexes exclusive like Python

They should be similar to Python
Also rename PoolByteArray::subarray to PoolByteArray::slice

func _ready() -> void:
	var pool := PoolByteArray([0, 1, 2, 3, 4, 5, 6, 7])
	
	aprint(pool.slice(0, 4))             ### 0, 1, 2, 3
	# Lines below would have crashed
	aprint(pool.slice(4, 8))             ### 4, 5, 6, 7
	aprint(pool.slice(0, pool.size()))   ### 0, 1, 2, 3, 4, 5, 6, 7

func aprint(pool: PoolByteArray) -> void:
	print(PoolStringArray(Array(pool)).join(", "))

Merge request reports