aboutsummaryrefslogtreecommitdiff
path: root/library/lullaby
diff options
context:
space:
mode:
Diffstat (limited to 'library/lullaby')
-rw-r--r--library/lullaby/table.lua (renamed from library/lullaby/array.lua)20
1 files changed, 18 insertions, 2 deletions
diff --git a/library/lullaby/array.lua b/library/lullaby/table.lua
index ebc23af..51414f7 100644
--- a/library/lullaby/array.lua
+++ b/library/lullaby/table.lua
@@ -1,31 +1,47 @@
---@meta
---to be rewritten
----@deprecated
----@class lullaby.array
+---@class lullaby.table
local table = {}
+---splits string into smaller strings, removing the delimiter
+---```lua
+---llby.table.split("/hello/world//test///", "/") -- {"hello", "world", "test"}
+---llby.table.split("/hello/world//test///", "/", false) -- {"hello", "world", "", "test", "", "", ""}
+---```
+---@param haystack string
+---@param search string
+---@param skip boolean? whether or not to skip empty chunks
+---@return string[]
+function table.split(haystack, search, skip) end
+
---greatest, least
+---@deprecated
---@param array number[]
function table.quicksort(array) end
---greatest, least
+---@deprecated
---@param array number[]
function table.mergesort(array) end
---greatest, least
+---@deprecated
---@param array number[]
function table.shellsort(array) end
---greatest, least
+---@deprecated
---@param array number[]
function table.bubblesort(array) end
---greatest, least
+---@deprecated
---@param array number[]
function table.heapsort(array) end
---least, greatest
+---@deprecated
---@param array integer[]
function table.countintsort(array) end