Problem with split()
- Posted by CraigWelch 1 month ago
- 424 views
From the documentation:
Example 2:
result = split("John,Middle,Doe", ",",, 2) -- Only want 2 sub-sequences. -- result is {"John", "Middle,Doe"}
My actual result:
result = split("John,Middle,Doe", ",",, 2) -- Only want 2 sub-sequences. -- result is {"John", "Middle", "Doe"}
However:
result = split("John,Middle,Doe", ",",, 1) -- Only want 2 sub-sequences. -- result is {"John", "Middle,Doe"}
In other words, the 'limit' operator needs to be one less than desired / documented.

