Module irc
LuaIRC is a low-level IRC library for Lua. All functions raise Lua exceptions on error.
Functions
| irc:connect (server, port, timeout) | Connects irc to server:port, with the connection timeout value timeout. |
| irc:disconnect (message) | Disconnects irc from the server, with the quit message message. |
| irc:hook (name, id, f) | Hooks function f to event name, with the unique tag id. |
| irc:join (channel, key) | Joins channel, optionally with the channel password key. |
| irc:part (channel) | Parts channel. |
| irc:send (fmt, ...) | Sends a raw line of IRC to the server. |
| irc:sendChat (target, msg) | Sends the message msg to target. |
| irc:sendNotice (target, msg) | Sends the notice msg to target. |
| irc:setMode (t) | Adds and/or removes modes for a channel or nick. |
| irc:think () | Handles incoming data for irc, and invokes previously hooked callbacks based on the new server input. |
| irc:trackUsers (b) | Specifies whether to cache user information or not with the boolean b. |
| irc:unhook (name, id) | Removes previous hooked callback with the tag id from event name. |
| irc:whois (nick) | Sends a WHOIS lookup request for nick. |
| new (user) | Create a new IRC object. |
Functions
- irc:connect (server, port, timeout)
-
Connects
irctoserver:port, with the connection timeout valuetimeout.Parameters
- server:
- port:
- timeout:
- irc:disconnect (message)
-
Disconnects
ircfrom the server, with the quit messagemessage.Parameters
- message:
- irc:hook (name, id, f)
-
Hooks function
fto eventname, with the unique tagid. If parameterfis absent,idis assumed to be both the callback function and unique tag.Parameters
- name:
- id:
- f:
- irc:join (channel, key)
-
Joins
channel, optionally with the channel passwordkey.Parameters
- channel:
- key:
- irc:part (channel)
-
Parts
channel.Parameters
- channel:
- irc:send (fmt, ...)
-
Sends a raw line of IRC to the server.
fmtis the line to be sent, without the newline characters.fmtcan be a format string taking the parameters..., withstring.formatsemantics.Parameters
- fmt:
- ...:
- irc:sendChat (target, msg)
-
Sends the message
msgtotarget.targetshould be either a channel or nick.Parameters
- target:
- msg:
- irc:sendNotice (target, msg)
-
Sends the notice
msgtotarget.targetshould be either a channel or nick.Parameters
- target:
- msg:
- irc:setMode (t)
-
Adds and/or removes modes for a channel or nick. Either
t.targetort.nickspecifies the channel or nick to add/remove modes.t.addis a list of modes to add to the target.t.remis a list of modes to remove from the target. Example which sets +m (moderated) for #channel:irc:setMode{target = "#channel", add = "m"}Parameters
- t:
- irc:think ()
-
Handles incoming data for
irc, and invokes previously hooked callbacks based on the new server input. You should call this in some kind of main loop, or at least often enough not to time out. - irc:trackUsers (b)
-
Specifies whether to cache user information or not with the boolean
b.Parameters
- b:
- irc:unhook (name, id)
-
Removes previous hooked callback with the tag
idfrom eventname.Parameters
- name:
- id:
- irc:whois (nick)
-
Sends a WHOIS lookup request for
nick. Returns a table with the fieldsuserinfo,node,channelsandaccount.Parameters
- nick:
- new (user)
-
Create a new IRC object. The
userparameter can contain fieldsnick,usernameandrealname. Thenickfield is required. Returns a newircobject.Parameters
- user: