add table.slice

This commit is contained in:
Xertis
2025-02-01 01:34:11 +03:00
parent 6592684db1
commit 17ce49bdf1
2 changed files with 18 additions and 0 deletions
+12
View File
@@ -196,6 +196,18 @@ function table.deep_flat(t)
return flat
end
function table.slice(arr, start, stop)
local sliced = {}
start = start or 1
stop = stop or #arr
for i = start, stop do
table.insert(sliced, arr[i])
end
return sliced
end
----------------------------------------------
local pattern_escape_replacements = {