feat(hsm): first version of hsm library functional

This commit is contained in:
swaits committed 2025-02-04 17:22:18 -07:00
1 parent bdc28c4e83
commit c8bdcccf27
12 files changed
+1371 -46

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
---
-- Splits the input string into an array of non-whitespace substrings.
--
-- This function uses Lua's pattern matching to iterate over the provided
-- string `s` and collects each contiguous sequence of non-whitespace
-- characters into a new table. If the input is not a string, the function
-- raises an error.
--
-- @param s string: The string to be split. Must be a valid string.
-- @return table: An array of substrings obtained by splitting `s` on whitespace.
-- @raise error if the input parameter `s` is not a string.
export split = (s) ->
unless type(s) == "string"
error "split() requires a string parameter"
chunks = {}
for substr in string.gmatch s, '%S+'
table.insert chunks, substr
chunks