From 5236ecaee4536fa5de0337df6c2d36ed492ef5ad Mon Sep 17 00:00:00 2001 From: Jakob Ovrum Date: Mon, 14 Jun 2010 23:12:33 +0900 Subject: [PATCH] Updated documentation with example --- doc/irc.luadoc | 22 ++++++++++++++++++++++ doc/modules/irc.html | 6 +++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/doc/irc.luadoc b/doc/irc.luadoc index 44ea413..97abe09 100644 --- a/doc/irc.luadoc +++ b/doc/irc.luadoc @@ -1,5 +1,27 @@ --- LuaIRC is a low-level IRC library for Lua. -- All functions raise Lua exceptions on error. +-- +-- Use new to create a new IRC object.
+-- Example:

+-- +--require "irc"
+--local sleep = require "socket".sleep
+--
+--local s = irc.new{nick = "example"}
+--
+--s:hook("OnChat", function(user, channel, message)
+-- print(("[%s] %s: %s"):format(channel, user.nick, message))
+--end)
+--
+--s:connect("irc.example.net")
+--s:join("#example")
+--
+--while true do
+-- s:think()
+-- sleep(0.5)
+--end
+--
+ module "irc" --- Create a new IRC object. diff --git a/doc/modules/irc.html b/doc/modules/irc.html index 27a5ded..3a12f4f 100644 --- a/doc/modules/irc.html +++ b/doc/modules/irc.html @@ -53,7 +53,7 @@

Module irc

-

LuaIRC is a low-level IRC library for Lua. All functions raise Lua exceptions on error.

+

LuaIRC is a low-level IRC library for Lua. All functions raise Lua exceptions on error. Use new to create a new IRC object.
Example:

require "irc"
local sleep = require "socket".sleep

local s = irc.new{nick = "example"}

s:hook("OnChat", function(user, channel, message)
print(("[%s] %s: %s"):format(channel, user.nick, message))
end)

s:connect("irc.example.net")
s:join("#example")

while true do
s:think()
sleep(0.5)
end

@@ -84,7 +84,7 @@ irc:part (channel) - Parts channel. + Leaves channel. @@ -275,7 +275,7 @@ Joins channel, optionally with the channel password keyirc:part (channel)
-Parts channel. +Leaves channel.

Parameters