mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2024-11-05 10:00:28 +01:00
Fixed broken parse function
This commit is contained in:
parent
09395a4d5f
commit
8b9adbd8e0
17
util.lua
17
util.lua
|
@ -17,12 +17,12 @@ function parse(line)
|
||||||
lineStart = space
|
lineStart = space
|
||||||
end
|
end
|
||||||
|
|
||||||
local trailtoken = line:find(":", lineStart)
|
local trailToken = line:find(":", lineStart)
|
||||||
local lineStop = -1
|
local lineStop = -1
|
||||||
local trailing
|
local trailing
|
||||||
if trailtoken then
|
if trailToken then
|
||||||
trailing = line:sub(trailtoken + 1)
|
trailing = line:sub(trailToken + 1)
|
||||||
lineStop = trailtoken - 2
|
lineStop = trailToken - 2
|
||||||
end
|
end
|
||||||
|
|
||||||
local params = {}
|
local params = {}
|
||||||
|
@ -31,12 +31,13 @@ function parse(line)
|
||||||
local pos = cmdEnd + 1
|
local pos = cmdEnd + 1
|
||||||
while true do
|
while true do
|
||||||
local _, stop, param = line:find("(%S+)", pos)
|
local _, stop, param = line:find("(%S+)", pos)
|
||||||
params[#params + 1] = param
|
|
||||||
pos = stop + 1
|
if stop >= lineStop then
|
||||||
|
|
||||||
if pos >= lineStop then
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
|
||||||
|
pos = stop + 1
|
||||||
|
params[#params + 1] = param
|
||||||
end
|
end
|
||||||
|
|
||||||
if trailing then
|
if trailing then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user