Skip to content

Instantly share code, notes, and snippets.

@Achie72
Created April 27, 2025 09:59
Show Gist options
  • Save Achie72/750ee386b9e67fe459d7d580b3e23ff7 to your computer and use it in GitHub Desktop.
Save Achie72/750ee386b9e67fe459d7d580b3e23ff7 to your computer and use it in GitHub Desktop.
insertion sort by impbox
-- Insertion Sort by @impbox
-- this will sort our closed list by the A* F value.
function sort(array)
for i=1,#array do
local j = i
while j > 1 and array[j-1].f < array[j].f do
array[j],array[j-1] = array[j-1],array[j]
j = j - 1
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment