Skip to content

Commit

Permalink
sort: truncate just to be safe...
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Apr 14, 2024
1 parent 2692d33 commit 14d3e6b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/sort/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::cmp::Ordering;

#[byond_fn]
pub fn sort(mut list: Vec<ByondValue>, proc_name: String) -> Vec<ByondValue> {
let original_len = list.len();
glidesort::sort_in_vec_by(&mut list, |a, b| {
match meowtonin::call_global::<_, _, _, Option<isize>>(&proc_name, [a, b])
.expect("sort proc failed")
Expand All @@ -15,5 +16,6 @@ pub fn sort(mut list: Vec<ByondValue>, proc_name: String) -> Vec<ByondValue> {
None => Ordering::Equal,
}
});
list.truncate(original_len);
list
}

0 comments on commit 14d3e6b

Please sign in to comment.