Factorio: correctly display player names with spaces and detect desyncs

This commit is contained in:
Fabian Dill
2021-07-04 15:25:56 +02:00
parent 5943c8975a
commit c669bc3e7f
3 changed files with 24 additions and 6 deletions

View File

@@ -20,4 +20,16 @@ function get_any_stack_size(name)
end
-- failsafe
return 1
end
-- from https://stackoverflow.com/a/40180465
-- split("a,b,c", ",") => {"a", "b", "c"}
function split(s, sep)
local fields = {}
sep = sep or " "
local pattern = string.format("([^%s]+)", sep)
string.gsub(s, pattern, function(c) fields[#fields + 1] = c end)
return fields
end