I just want to be able to split comma-separated Cargo list fields. The notes on mw.text.split at Extension:Scribunto/Lua_reference_manual says "this function can be over 60 times slower than a reimplementation that is not Unicode-aware". I modified something from the internet. Would it make any noticeable speed difference - does it look like it will work all right? - are there better ways? It seems to work but I don't know Lua yet.
-- Source: http://lua-users.org/wiki/MakingLuaLikePhp (modified)
-- Credit: http://richard.warburton.it/
function explode(str)
local pos,arr = 0,{}
for st,sp in function() return string.find(str,',',pos,true) end do
table.insert(arr,string.sub(str,pos,st-1))
pos = sp + 1
end
table.insert(arr,string.sub(str,pos))
return arr
end