mirror of
https://github.com/ShadowNinja/LuaIRC.git
synced 2025-01-09 09:30:28 +01:00
Interpret format codes passed to meta:send() literally if there are no format arguments
This commit is contained in:
parent
1d0480adba
commit
ddb788883e
@ -1,12 +1,16 @@
|
||||
local table = table
|
||||
local assert = assert
|
||||
local select = select
|
||||
|
||||
module "irc"
|
||||
|
||||
local meta = _META
|
||||
|
||||
function meta:send(fmt, ...)
|
||||
local bytes, err = self.socket:send(fmt:format(...) .. "\r\n")
|
||||
function meta:send(msg, ...)
|
||||
if select("#", ...) > 0 then
|
||||
msg = msg:format(...)
|
||||
end
|
||||
local bytes, err = self.socket:send(msg .. "\r\n")
|
||||
|
||||
if not bytes and err ~= "timeout" and err ~= "wantwrite" then
|
||||
self:invoke("OnDisconnect", err, true)
|
||||
|
@ -71,9 +71,9 @@ function irc:whois(nick)
|
||||
function irc:topic(channel)
|
||||
|
||||
--- Send a raw line of IRC to the server.
|
||||
-- @param fmt Line to be sent, excluding newline characters.
|
||||
-- @param ... Format parameters for <code>fmt</code>, with <code>string.format</code> semantics.
|
||||
function irc:send(fmt, ...)
|
||||
-- @param msg Line to be sent, excluding newline characters.
|
||||
-- @param ... Format parameters for <code>msg</code>, with <code>string.format</code> semantics. [optional]
|
||||
function irc:send(msg, ...)
|
||||
|
||||
--- Send a message to a channel or user.
|
||||
-- @param target Nick or channel to send to.
|
||||
|
Loading…
Reference in New Issue
Block a user