Bubble sort in GDScript (Godot Engine 2.1)

I was needed to sort some game objects by position on the screen. There are a lot of sorting algorithms, and simplest one is the Bubble Sort algorithm. It works fine for me because I have the small count of objects to sort. 
There is the code example in GDScript that sorts simple array of numbers:

Comments