I would say that the best answer I know about right now is to consider Penlight as a Lua’s standard library and use https://lunarmodules.github.io/Penlight/libraries/pl.stringx.html#split
Penlight