The string.split() function in wagons.lua line 851 gives wrong results for
non-single-character separators.
Note that this is overriding the minetest builtin split function (see
https://github.com/minetest/minetest/blob/master/builtin/common/misc_helpers.lua#L171)
and thus also affects other mods.
To reproduce: run the following test code. Expected result would be:
1: Demo string, break me on
2: occurrences.
Obtained result is:
1: Demo
2: ing, b
3: eak me on
4: occu
5: ence
6: .
function string:split(sep)
local fields = {}
local pattern = string.format("([^%s]+)", sep)
self:gsub(pattern, function(c) fields[#fields+1] = c end)
return fields
end
local demo = "Demo string, break me on trs occurrences."
local result = demo:split("trs")
for i,v in ipairs(result) do
print(tostring(i) .. ": " .. v)
end
This was fixed by commit 606fc83465d8742550e9f70a13b51bbb9cd6f45e
Great, thanks. Wasn't published in the repo yet, that's why i posted the
issue here too...
Il giorno sab 5 set 2020 alle ore 22:00 <160@bugs.linux-forks.de> ha
scritto:
>
> This was fixed by commit 606fc83465d8742550e9f70a13b51bbb9cd6f45e
>