Added documentation

This commit is contained in:
Jakob Ovrum 2010-06-14 22:57:08 +09:00
parent 236c3ff2b1
commit bbee4910a3
5 changed files with 1211 additions and 0 deletions

215
doc/files/irc.html Normal file
View File

@ -0,0 +1,215 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaDoc</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<!-- Module list -->
<h1>Modules</h1>
<ul>
<li>
<a href="../modules/irc.html">irc</a>
</li>
</ul>
<!-- File list -->
<h1>Files</h1>
<ul>
<li><strong>irc.luadoc</strong></li>
</ul>
</div> <!-- id="navigation" -->
<div id="content">
<h1>File <code>irc.luadoc</code></h1>
<p>LuaIRC is a low-level IRC library for Lua.</p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#meta:hook">meta:hook</a>&nbsp;(name, id [, f])</td>
<td class="summary">Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#meta:send">meta:send</a>&nbsp;(fmt, ...)</td>
<td class="summary">Sends a line of raw IRC to the server Test Test 2 </td>
</tr>
<tr>
<td class="name" nowrap><a href="#new">new</a>&nbsp;(user)</td>
<td class="summary">Create a new IRC object.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="meta:hook"></a><strong>meta:hook</strong>&nbsp;(name, id [, f])</dt>
<dd>
Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>. If parameter <code>f</code> is absent, <code>id</code> is assumed to be both the callback function and unique tag.
<h3>Parameters</h3>
<ul>
<li>
name:
</li>
<li>
id [:
</li>
<li>
f]:
</li>
</ul>
</dd>
<dt><a name="meta:send"></a><strong>meta:send</strong>&nbsp;(fmt, ...)</dt>
<dd>
Sends a line of raw IRC to the server Test Test 2
<h3>Parameters</h3>
<ul>
<li>
fmt:
</li>
<li>
...:
</li>
</ul>
</dd>
<dt><a name="new"></a><strong>new</strong>&nbsp;(user)</dt>
<dd>
Create a new IRC object. The <code>user</code> parameter can contain fields <code>nick</code>, <code>username</code> and <code>realname</code>. The <code>nick</code> field is required.
<h3>Parameters</h3>
<ul>
<li>
user:
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

84
doc/index.html Normal file
View File

@ -0,0 +1,84 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaDoc</h1>
<ul>
<li><strong>Index</strong></li>
</ul>
<!-- Module list -->
<h1>Modules</h1>
<ul>
<li>
<a href="modules/irc.html">irc</a>
</li>
</ul>
<!-- File list -->
</div> <!-- id="navigation" -->
<div id="content">
<h2>Modules</h2>
<table class="module_list">
<!--<tr><td colspan="2">Modules</td></tr>-->
<tr>
<td class="name"><a href="modules/irc.html">irc</a></td>
<td class="summary">LuaIRC is a low-level IRC library for Lua.</td>
</tr>
</table>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

68
doc/irc.luadoc Normal file
View File

@ -0,0 +1,68 @@
--- LuaIRC is a low-level IRC library for Lua.
-- All functions raise Lua exceptions on error.
module "irc"
--- Create a new IRC object.
-- The <code>user</code> parameter can contain fields <code>nick</code>, <code>username</code> and <code>realname</code>.
-- The <code>nick</code> field is required.
-- Returns a new <code>irc</code> object.
function new(user)
--- Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>.
-- If parameter <code>f</code> is absent, <code>id</code> is assumed to be both the callback function and unique tag.
function irc:hook(name, id, f)
--- Removes previous hooked callback with the tag <code>id</code> from event <code>name</code>.
function irc:unhook(name, id)
--internal
function irc:invoke(name, ...)
--- Connects <code>irc</code> to <code>server:port</code>, with the connection timeout value <code>timeout</code>.
function irc:connect(server, port, timeout)
--- Disconnects <code>irc</code> from the server, with the quit message <code>message</code>.
function irc:disconnect(message)
--internal
function irc:shutdown()
--- Handles incoming data for <code>irc</code>, 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.
function irc:think()
--internal
function irc:handle(prefix, cmd, params)
--- Sends a WHOIS lookup request for <code>nick</code>.
-- Returns a table with the fields <code>userinfo</code>, <code>node</code>, <code>channels</code> and <code>account</code>.
function irc:whois(nick)
--- Sends a raw line of IRC to the server.
-- <code>fmt</code> is the line to be sent, without the newline characters.
-- <code>fmt</code> can be a format string taking the parameters <code>...</code>, with <code>string.format</code> semantics.
function irc:send(fmt, ...)
--- Sends the message <code>msg</code> to <code>target</code>.
-- <code>target</code> should be either a channel or nick.
function irc:sendChat(target, msg)
--- Sends the notice <code>msg</code> to <code>target</code>.
-- <code>target</code> should be either a channel or nick.
function irc:sendNotice(target, msg)
--- Joins <code>channel</code>, optionally with the channel password <code>key</code>.
function irc:join(channel, key)
--- Leaves <code>channel</code>.
function irc:part(channel)
--- Specifies whether to cache user information or not with the boolean <code>b</code>.
function irc:trackUsers(b)
--- Adds and/or removes modes for a channel or nick.
-- Either <code>t.target</code> or <code>t.nick</code> specifies the channel or nick to add/remove modes.
-- <code>t.add</code> is a list of modes to add to the target.
-- <code>t.rem</code> is a list of modes to remove from the target.
-- Example which sets +m (moderated) for #channel: <code>irc:setMode{target = "#channel", add = "m"}</code>
function irc:setMode(t)

286
doc/luadoc.css Normal file
View File

@ -0,0 +1,286 @@
body {
margin-left: 1em;
margin-right: 1em;
font-family: arial, helvetica, geneva, sans-serif;
background-color:#ffffff; margin:0px;
}
code {
font-family: "Andale Mono", monospace;
}
tt {
font-family: "Andale Mono", monospace;
}
body, td, th { font-size: 11pt; }
h1, h2, h3, h4 { margin-left: 0em; }
textarea, pre, tt { font-size:10pt; }
body, td, th { color:#000000; }
small { font-size:0.85em; }
h1 { font-size:1.5em; }
h2 { font-size:1.25em; }
h3 { font-size:1.15em; }
h4 { font-size:1.06em; }
a:link { font-weight:bold; color: #004080; text-decoration: none; }
a:visited { font-weight:bold; color: #006699; text-decoration: none; }
a:link:hover { text-decoration:underline; }
hr { color:#cccccc }
img { border-width: 0px; }
h3 { padding-top: 1em; }
p { margin-left: 1em; }
p.name {
font-family: "Andale Mono", monospace;
padding-top: 1em;
margin-left: 0em;
}
blockquote { margin-left: 3em; }
pre.example {
background-color: rgb(245, 245, 245);
border-top-width: 1px;
border-right-width: 1px;
border-bottom-width: 1px;
border-left-width: 1px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-top-color: silver;
border-right-color: silver;
border-bottom-color: silver;
border-left-color: silver;
padding: 1em;
margin-left: 1em;
margin-right: 1em;
font-family: "Andale Mono", monospace;
font-size: smaller;
}
hr {
margin-left: 0em;
background: #00007f;
border: 0px;
height: 1px;
}
ul { list-style-type: disc; }
table.index { border: 1px #00007f; }
table.index td { text-align: left; vertical-align: top; }
table.index ul { padding-top: 0em; margin-top: 0em; }
table {
border: 1px solid black;
border-collapse: collapse;
margin-left: auto;
margin-right: auto;
}
th {
border: 1px solid black;
padding: 0.5em;
}
td {
border: 1px solid black;
padding: 0.5em;
}
div.header, div.footer { margin-left: 0em; }
#container
{
margin-left: 1em;
margin-right: 1em;
background-color: #f0f0f0;
}
#product
{
text-align: center;
border-bottom: 1px solid #cccccc;
background-color: #ffffff;
}
#product big {
font-size: 2em;
}
#product_logo
{
}
#product_name
{
}
#product_description
{
}
#main
{
background-color: #f0f0f0;
border-left: 2px solid #cccccc;
}
#navigation
{
float: left;
width: 18em;
margin: 0;
vertical-align: top;
background-color: #f0f0f0;
overflow:visible;
}
#navigation h1 {
background-color:#e7e7e7;
font-size:1.1em;
color:#000000;
text-align:left;
margin:0px;
padding:0.2em;
border-top:1px solid #dddddd;
border-bottom:1px solid #dddddd;
}
#navigation ul
{
font-size:1em;
list-style-type: none;
padding: 0;
margin: 1px;
}
#navigation li
{
text-indent: -1em;
margin: 0em 0em 0em 0.5em;
display: block;
padding: 3px 0px 0px 12px;
}
#navigation li li a
{
padding: 0px 3px 0px -1em;
}
#content
{
margin-left: 18em;
padding: 1em;
border-left: 2px solid #cccccc;
border-right: 2px solid #cccccc;
background-color: #ffffff;
}
#about
{
clear: both;
margin: 0;
padding: 5px;
border-top: 2px solid #cccccc;
background-color: #ffffff;
}
@media print {
body {
font: 12pt "Times New Roman", "TimeNR", Times, serif;
}
a { font-weight:bold; color: #004080; text-decoration: underline; }
#main { background-color: #ffffff; border-left: 0px; }
#container { margin-left: 2%; margin-right: 2%; background-color: #ffffff; }
#content { margin-left: 0px; padding: 1em; border-left: 0px; border-right: 0px; background-color: #ffffff; }
#navigation { display: none;
}
pre.example {
font-family: "Andale Mono", monospace;
font-size: 10pt;
page-break-inside: avoid;
}
}
table.module_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.module_list td.name { background-color: #f0f0f0; }
table.module_list td.summary { width: 100%; }
table.file_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.file_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.file_list td.name { background-color: #f0f0f0; }
table.file_list td.summary { width: 100%; }
table.function_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.function_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.function_list td.name { background-color: #f0f0f0; }
table.function_list td.summary { width: 100%; }
table.table_list
{
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.table_list td
{
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.table_list td.name { background-color: #f0f0f0; }
table.table_list td.summary { width: 100%; }
dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
dl.function dd {padding-bottom: 1em;}
dl.function h3 {padding: 0; margin: 0; font-size: medium;}
dl.table dt {border-top: 1px solid #ccc; padding-top: 1em;}
dl.table dd {padding-bottom: 1em;}
dl.table h3 {padding: 0; margin: 0; font-size: medium;}
#TODO: make module_list, file_list, function_list, table_list inherit from a list

558
doc/modules/irc.html Normal file
View File

@ -0,0 +1,558 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Reference</title>
<link rel="stylesheet" href="../luadoc.css" type="text/css" />
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
</head>
<body>
<div id="container">
<div id="product">
<div id="product_logo"></div>
<div id="product_name"><big><b></b></big></div>
<div id="product_description"></div>
</div> <!-- id="product" -->
<div id="main">
<div id="navigation">
<h1>LuaDoc</h1>
<ul>
<li><a href="../index.html">Index</a></li>
</ul>
<!-- Module list -->
<h1>Modules</h1>
<ul>
<li><strong>irc</strong></li>
</ul>
<!-- File list -->
</div><!-- id="navigation" -->
<div id="content">
<h1>Module <code>irc</code></h1>
<p>LuaIRC is a low-level IRC library for Lua. All functions raise Lua exceptions on error.</p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#irc:connect">irc:connect</a>&nbsp;(server, port, timeout)</td>
<td class="summary">Connects <code>irc</code> to <code>server:port</code>, with the connection timeout value <code>timeout</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:disconnect">irc:disconnect</a>&nbsp;(message)</td>
<td class="summary">Disconnects <code>irc</code> from the server, with the quit message <code>message</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:hook">irc:hook</a>&nbsp;(name, id, f)</td>
<td class="summary">Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:join">irc:join</a>&nbsp;(channel, key)</td>
<td class="summary">Joins <code>channel</code>, optionally with the channel password <code>key</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:part">irc:part</a>&nbsp;(channel)</td>
<td class="summary">Parts <code>channel</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:send">irc:send</a>&nbsp;(fmt, ...)</td>
<td class="summary">Sends a raw line of IRC to the server.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:sendChat">irc:sendChat</a>&nbsp;(target, msg)</td>
<td class="summary">Sends the message <code>msg</code> to <code>target</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:sendNotice">irc:sendNotice</a>&nbsp;(target, msg)</td>
<td class="summary">Sends the notice <code>msg</code> to <code>target</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:setMode">irc:setMode</a>&nbsp;(t)</td>
<td class="summary">Adds and/or removes modes for a channel or nick.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:think">irc:think</a>&nbsp;()</td>
<td class="summary">Handles incoming data for <code>irc</code>, and invokes previously hooked callbacks based on the new server input.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:trackUsers">irc:trackUsers</a>&nbsp;(b)</td>
<td class="summary">Specifies whether to cache user information or not with the boolean <code>b</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:unhook">irc:unhook</a>&nbsp;(name, id)</td>
<td class="summary">Removes previous hooked callback with the tag <code>id</code> from event <code>name</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#irc:whois">irc:whois</a>&nbsp;(nick)</td>
<td class="summary">Sends a WHOIS lookup request for <code>nick</code>.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#new">new</a>&nbsp;(user)</td>
<td class="summary">Create a new IRC object.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="irc:connect"></a><strong>irc:connect</strong>&nbsp;(server, port, timeout)</dt>
<dd>
Connects <code>irc</code> to <code>server:port</code>, with the connection timeout value <code>timeout</code>.
<h3>Parameters</h3>
<ul>
<li>
server:
</li>
<li>
port:
</li>
<li>
timeout:
</li>
</ul>
</dd>
<dt><a name="irc:disconnect"></a><strong>irc:disconnect</strong>&nbsp;(message)</dt>
<dd>
Disconnects <code>irc</code> from the server, with the quit message <code>message</code>.
<h3>Parameters</h3>
<ul>
<li>
message:
</li>
</ul>
</dd>
<dt><a name="irc:hook"></a><strong>irc:hook</strong>&nbsp;(name, id, f)</dt>
<dd>
Hooks function <code>f</code> to event <code>name</code>, with the unique tag <code>id</code>. If parameter <code>f</code> is absent, <code>id</code> is assumed to be both the callback function and unique tag.
<h3>Parameters</h3>
<ul>
<li>
name:
</li>
<li>
id:
</li>
<li>
f:
</li>
</ul>
</dd>
<dt><a name="irc:join"></a><strong>irc:join</strong>&nbsp;(channel, key)</dt>
<dd>
Joins <code>channel</code>, optionally with the channel password <code>key</code>.
<h3>Parameters</h3>
<ul>
<li>
channel:
</li>
<li>
key:
</li>
</ul>
</dd>
<dt><a name="irc:part"></a><strong>irc:part</strong>&nbsp;(channel)</dt>
<dd>
Parts <code>channel</code>.
<h3>Parameters</h3>
<ul>
<li>
channel:
</li>
</ul>
</dd>
<dt><a name="irc:send"></a><strong>irc:send</strong>&nbsp;(fmt, ...)</dt>
<dd>
Sends a raw line of IRC to the server. <code>fmt</code> is the line to be sent, without the newline characters. <code>fmt</code> can be a format string taking the parameters <code>...</code>, with <code>string.format</code> semantics.
<h3>Parameters</h3>
<ul>
<li>
fmt:
</li>
<li>
...:
</li>
</ul>
</dd>
<dt><a name="irc:sendChat"></a><strong>irc:sendChat</strong>&nbsp;(target, msg)</dt>
<dd>
Sends the message <code>msg</code> to <code>target</code>. <code>target</code> should be either a channel or nick.
<h3>Parameters</h3>
<ul>
<li>
target:
</li>
<li>
msg:
</li>
</ul>
</dd>
<dt><a name="irc:sendNotice"></a><strong>irc:sendNotice</strong>&nbsp;(target, msg)</dt>
<dd>
Sends the notice <code>msg</code> to <code>target</code>. <code>target</code> should be either a channel or nick.
<h3>Parameters</h3>
<ul>
<li>
target:
</li>
<li>
msg:
</li>
</ul>
</dd>
<dt><a name="irc:setMode"></a><strong>irc:setMode</strong>&nbsp;(t)</dt>
<dd>
Adds and/or removes modes for a channel or nick. Either <code>t.target</code> or <code>t.nick</code> specifies the channel or nick to add/remove modes. <code>t.add</code> is a list of modes to add to the target. <code>t.rem</code> is a list of modes to remove from the target. Example which sets +m (moderated) for #channel: <code>irc:setMode{target = "#channel", add = "m"}</code>
<h3>Parameters</h3>
<ul>
<li>
t:
</li>
</ul>
</dd>
<dt><a name="irc:think"></a><strong>irc:think</strong>&nbsp;()</dt>
<dd>
Handles incoming data for <code>irc</code>, 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.
</dd>
<dt><a name="irc:trackUsers"></a><strong>irc:trackUsers</strong>&nbsp;(b)</dt>
<dd>
Specifies whether to cache user information or not with the boolean <code>b</code>.
<h3>Parameters</h3>
<ul>
<li>
b:
</li>
</ul>
</dd>
<dt><a name="irc:unhook"></a><strong>irc:unhook</strong>&nbsp;(name, id)</dt>
<dd>
Removes previous hooked callback with the tag <code>id</code> from event <code>name</code>.
<h3>Parameters</h3>
<ul>
<li>
name:
</li>
<li>
id:
</li>
</ul>
</dd>
<dt><a name="irc:whois"></a><strong>irc:whois</strong>&nbsp;(nick)</dt>
<dd>
Sends a WHOIS lookup request for <code>nick</code>. Returns a table with the fields <code>userinfo</code>, <code>node</code>, <code>channels</code> and <code>account</code>.
<h3>Parameters</h3>
<ul>
<li>
nick:
</li>
</ul>
</dd>
<dt><a name="new"></a><strong>new</strong>&nbsp;(user)</dt>
<dd>
Create a new IRC object. The <code>user</code> parameter can contain fields <code>nick</code>, <code>username</code> and <code>realname</code>. The <code>nick</code> field is required. Returns a new <code>irc</code> object.
<h3>Parameters</h3>
<ul>
<li>
user:
</li>
</ul>
</dd>
</dl>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>