Update split.lua

This commit is contained in:
VorTechnix 2024-09-12 09:54:40 -07:00
parent 005615df02
commit e24997dd80
No known key found for this signature in database
GPG Key ID: 091E91A69545D5BA

@ -58,11 +58,12 @@ end
--- Split a string into substrings separated by a pattern.
-- @param str string The string to iterate over
-- @param dlm string The delimiter (separator) pattern
-- @param dlm string The delimiter (separator) pattern (default: "%s+")
-- @param plain boolean If true (or truthy), pattern is interpreted as a
-- plain string, not a Lua pattern
-- @returns table A sequence table containing the substrings
local function split(str,dlm,plain)
if not dlm then dlm = "%s+" end
local pos, ret = 0, {}
local ins, i = str:find(dlm,pos,plain)
-- "if plain" shaves off some time in the while statement