Current behavior threads all separators as important, as it is the case in CSV files.
But for case where separators are just sequence of spaces 'split' returns unpredictable number of empty elements.
In proposed implementation there is a optional argument (preserving original behavior) that will skip adding any empty element to resulting array.
Example of such input is:
local a = split(" 123 456", " ")
--> [ "", "", "123", "", "", "","456"] (default)
local a = split(" 123 456", " ",true)
--> [ "123","456"] (without empty elements)
Current behavior threads all separators as important, as it is the case in CSV files. But for case where separators are just sequence of spaces 'split' returns unpredictable number of empty elements. In proposed implementation there is a optional argument (preserving original behavior) that will skip adding any empty element to resulting array.
Example of such input is: local a = split(" 123 456", " ") --> [ "", "", "123", "", "", "","456"] (default) local a = split(" 123 456", " ",true) --> [ "123","456"] (without empty elements)