From cc453c0dcd718060356f2d73257df2c82857ead0 Mon Sep 17 00:00:00 2001 From: VegetationBush <98243286+VegetationBush@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:26:44 -0400 Subject: [PATCH] Delete unordered-table-remove.md --- unordered-table-remove.md | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 unordered-table-remove.md diff --git a/unordered-table-remove.md b/unordered-table-remove.md deleted file mode 100644 index fd581da..0000000 --- a/unordered-table-remove.md +++ /dev/null @@ -1,27 +0,0 @@ -# Unordered `table.remove()` - -## Summary - -Add an unordered remove method to the table library. - -## Motivation - -For arrays that are known to be unsorted, using `table.remove()` to remove indicies is unperformant, as `table.remove()` takes O(n) time to complete. This is a gross use of resources, especially if this behavior is not required by the user. Thus, it's logical to conclude that an analogous method that performs an *unordered remove* would be the clear next step. - -## Design - -The naming of the new method is proposed as `uremove`. However, for clarity reasons, this may not be the best name choice as `uremove` types very similar to `remove`. The implementation of the method could be as such: -```lua -function table.uremove(t: {any}, index: number) - t[index], t[#t] = t[#t], nil -end -``` -Valid argument checking is optional. - -## Drawbacks - -Possibly none, apart from an extra method in the table library. - -## Alternatives - -Users can define the function themselves.