aboutsummaryrefslogtreecommitdiff
path: root/library
diff options
context:
space:
mode:
authorame <[email protected]>2025-06-12 02:08:47 -0500
committerame <[email protected]>2025-06-12 02:08:47 -0500
commitec91aab02442dbbf577fa8d8e68c79a09b55f3f9 (patch)
treee201087adabba53febc0df9a34db4577755f5961 /library
parentc3efe329c55727ca68c4975dccc774b279479fc3 (diff)
rename 'array' lib and small additions
Diffstat (limited to 'library')
-rw-r--r--library/lullaby.lua2
-rw-r--r--library/lullaby/table.lua (renamed from library/lullaby/array.lua)20
2 files changed, 19 insertions, 3 deletions
diff --git a/library/lullaby.lua b/library/lullaby.lua
index 9f66530..db04f5e 100644
--- a/library/lullaby.lua
+++ b/library/lullaby.lua
@@ -9,7 +9,7 @@ lullaby.error = require("library.lullaby.error")
lullaby.io = require("library.lullaby.io")
lullaby.math = require("library.lullaby.math")
lullaby.net = require("library.lullaby.net")
-lullaby.array = require("library.lullaby.array")
+lullaby.table = require("library.lullaby.table")
lullaby.test = require("library.lullaby.test")
lullaby.thread = require("library.lullaby.thread")
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