mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Factorio: correctly display player names with spaces and detect desyncs
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user