diff --git a/data/lua/wml/modify_unit.lua b/data/lua/wml/modify_unit.lua index 4a8d6ed4ac9..ca0a3d3fd5a 100644 --- a/data/lua/wml/modify_unit.lua +++ b/data/lua/wml/modify_unit.lua @@ -7,12 +7,13 @@ local wml_actions = wesnoth.wml_actions -- in the first part of this file and the fallback (old) implementation in the -- second part of this file -local function split_to_array(str, sep) +local function split_to_array(str) -- Split string @str into a table using the delimiter @sep (default: ',') - local sep, fields = sep or ",", {} - local pattern = string.format("([^%s]+)", sep) - string.gsub(str, pattern, function(c) fields[#fields+1] = c end) + local fields = {} + for c in utils.split(str) do + fields[#fields+1] = c + end return fields end