1
0
mirror of https://github.com/minetest-mods/irc.git synced 2024-11-11 12:20:24 +01:00

Use upvalues in anonymous functions

This commit is contained in:
ShadowNinja 2013-10-19 18:45:39 -04:00
parent 85b4ba3f8f
commit 0901083dd0

View File

@ -57,7 +57,7 @@ function mt_irc:step(dtime)
end end
-- Hooks will manage incoming messages and errors -- Hooks will manage incoming messages and errors
if not pcall(function() mt_irc.conn:think() end) then if not pcall(function() self.conn:think() end) then
return return
end end
@ -88,19 +88,19 @@ function mt_irc:connect()
}) })
self:doHook(self.conn) self:doHook(self.conn)
good, message = pcall(function() good, message = pcall(function()
mt_irc.conn:connect({ self.conn:connect({
host = mt_irc.config.server, host = self.config.server,
port = mt_irc.config.port, port = self.config.port,
pass = mt_irc.config.password, pass = self.config.password,
timeout = mt_irc.config.timeout, timeout = self.config.timeout,
secure = mt_irc.config.secure secure = self.config.secure
}) })
end) end)
if not good then if not good then
minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in ten minutes...") minetest.log("error", ("IRC: Connection error: %s: %s -- Reconnecting in ten minutes...")
:format(self.config.server, message)) :format(self.config.server, message))
minetest.after(600, function() mt_irc:connect() end) minetest.after(600, function() self:connect() end)
return return
end end