mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2025-01-10 01:50:26 +01:00
Cleaning up getline function
This commit is contained in:
parent
d3c6ab849b
commit
ca767c8b42
8
init.lua
8
init.lua
@ -149,15 +149,13 @@ end
|
|||||||
local function getline(self, errlevel)
|
local function getline(self, errlevel)
|
||||||
local line, err = self.socket:receive("*l")
|
local line, err = self.socket:receive("*l")
|
||||||
|
|
||||||
if line then
|
if not line and err ~= "timeout" and err ~= "wantread" then
|
||||||
return line
|
|
||||||
end
|
|
||||||
|
|
||||||
if err ~= "timeout" and err ~= "wantread" then
|
|
||||||
self:invoke("OnDisconnect", err, true)
|
self:invoke("OnDisconnect", err, true)
|
||||||
self:shutdown()
|
self:shutdown()
|
||||||
error(err, errlevel)
|
error(err, errlevel)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return line
|
||||||
end
|
end
|
||||||
|
|
||||||
function meta:think()
|
function meta:think()
|
||||||
|
Loading…
Reference in New Issue
Block a user