Skip to content

Commit e5bab33

Browse files
committed
Whitespace stripping when loading
1 parent 55b4b92 commit e5bab33

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

coop.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ if emu.emulating() then
5151

5252
function scrub(invalid) errorMessage(invalid .. " not valid") failed = true end
5353

54-
if failed then -- NOTHING
55-
elseif not nonempty(data.server) then scrub("Server")
54+
-- Strip out stray whitespace (this can be a problem on FCEUX)
55+
for _,v in ipairs{"server", "nick", "partner"} do
56+
if data[v] then data[v] = data[v]:gsub("%s+", "") end
57+
end
58+
59+
-- Check input valid
60+
if not nonempty(data.server) then scrub("Server")
5661
elseif not nonzero(data.port) then scrub("Port")
5762
elseif not nonempty(data.nick) then scrub("Nick")
5863
elseif not nonempty(data.partner) then scrub("Partner nick")

0 commit comments

Comments
 (0)