<!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/CharacterManager.html">CharacterManager</a>
</li>
<li>
<a href="../modules/Direction.html">Direction</a>
</li>
<li>
<a href="../modules/Game.html">Game</a>
</li>
<li>
<a href="../modules/GameState.html">GameState</a>
</li>
<li>
<a href="../modules/MessageMode.html">MessageMode</a>
</li>
<li>
<a href="../modules/Nanny.html">Nanny</a>
</li>
<li>
<a href="../modules/PlayerState.html">PlayerState</a>
</li>
<li>
<a href="../modules/Telnet.html">Telnet</a>
</li>
<li>
<a href="../modules/config.html">config</a>
</li>
<li>
<a href="../modules/ext.string.html">ext.string</a>
</li>
<li>
<a href="../modules/ext.table.html">ext.table</a>
</li>
<li>
<a href="../modules/main.html">main</a>
</li>
<li><strong>obj.Client</strong></li>
<li>
<a href="../modules/obj.Cloneable.html">obj.Cloneable</a>
</li>
<li>
<a href="../modules/obj.Command.html">obj.Command</a>
</li>
<li>
<a href="../modules/obj.CommandParser.html">obj.CommandParser</a>
</li>
<li>
<a href="../modules/obj.Event.html">obj.Event</a>
</li>
<li>
<a href="../modules/obj.Map.html">obj.Map</a>
</li>
<li>
<a href="../modules/obj.MapObject.html">obj.MapObject</a>
</li>
<li>
<a href="../modules/obj.MapTile.html">obj.MapTile</a>
</li>
<li>
<a href="../modules/obj.Mob.html">obj.Mob</a>
</li>
<li>
<a href="../modules/obj.Player.html">obj.Player</a>
</li>
<li>
<a href="../modules/obj.Scheduler.html">obj.Scheduler</a>
</li>
<li>
<a href="../modules/obj.Server.html">obj.Server</a>
</li>
</ul>
<!-- File list -->
</div><!-- id="navigation" -->
<div id="content">
<h1>Module <code>obj.Client</code></h1>
<p>Cloneable that manages user I/O.</p>
<p><b>Author:</b>
<table class="authors_list">
<tr><td class="name">milkmanjack</td></tr>
</table>
</p>
<h2>Functions</h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Client:close">Client:close</a> ()</td>
<td class="summary">Close the client's socket.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getAddress">Client:getAddress</a> ()</td>
<td class="summary">Retreive the client's remote address.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getDo">Client:getDo</a> (op)</td>
<td class="summary">Check if the client expects us to negotiate this option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getDont">Client:getDont</a> (op)</td>
<td class="summary">Check if the client expects us not to negotiate this option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getSocket">Client:getSocket</a> ()</td>
<td class="summary">Retreive the client's socket.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getTerminalType">Client:getTerminalType</a> ()</td>
<td class="summary">Retreive the client's terminal type, if applicable.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getWill">Client:getWill</a> (op)</td>
<td class="summary">Check if we will negotiate the given option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:getWont">Client:getWont</a> (op)</td>
<td class="summary">Check if we will not negotiate the given option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:initialize">Client:initialize</a> (socket, updateOptions)</td>
<td class="summary">Associates a socket with the Client.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:onDo">Client:onDo</a> (op)</td>
<td class="summary">What to do when receiving an IAC DO option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:onDont">Client:onDont</a> (op)</td>
<td class="summary">What to do when receiving an IAC DONT option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:onSubnegotiation">Client:onSubnegotiation</a> (negotiation)</td>
<td class="summary">What to do when receiving an IAC SE subnegotiation.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:onWill">Client:onWill</a> (op)</td>
<td class="summary">What to do when receiving an IAC WILL option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:onWont">Client:onWont</a> (op)</td>
<td class="summary">What to do when receiving an IAC WONT option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:receive">Client:receive</a> (pattern, prefix)</td>
<td class="summary">Pipe to socket's receive() function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:send">Client:send</a> (data, i, j)</td>
<td class="summary">Pipe to socket's send() function.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendDo">Client:sendDo</a> (op)</td>
<td class="summary">Send an IAC DO message with the given option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendDont">Client:sendDont</a> (op)</td>
<td class="summary">Send an IAC DONT message with the given option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendLine">Client:sendLine</a> (str)</td>
<td class="summary">Sends the given string to the client followed by a linebreak.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendString">Client:sendString</a> (str)</td>
<td class="summary">Formats a string before sending it to the client.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendSupportedOptions">Client:sendSupportedOptions</a> ()</td>
<td class="summary">Inform the Client of which options we support.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendWill">Client:sendWill</a> (op)</td>
<td class="summary">Send an IAC WILL message with the given option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:sendWont">Client:sendWont</a> (op)</td>
<td class="summary">Send an IAC WONT message with the given option.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:setSocket">Client:setSocket</a> (socket)</td>
<td class="summary">Manually assign socket.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client:toString">Client:toString</a> ()</td>
<td class="summary">Returns the string-value of the Client.</td>
</tr>
</table>
<h2>Tables</h2>
<table class="table_list">
<tr>
<td class="name" nowrap><a href="#Client">Client</a></td>
<td class="summary">Cloneable that manages user I/O.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options">Client.options</a></td>
<td class="summary">Contains all telnet protocol options on the client.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options.DO Client.options.DO = nil">Client.options.DO Client.options.DO = nil</a></td>
<td class="summary">Contains currently flagged options that the Client wants the Server to negotiate.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options.DONT Client.options.DONT = nil">Client.options.DONT Client.options.DONT = nil</a></td>
<td class="summary">Contains currently flagged options that the Client doesn't want the Server to negotiate.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options.MCCP2">Client.options.MCCP2</a></td>
<td class="summary">Contains MCCP2 zlib streams.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options.TTYPE">Client.options.TTYPE</a></td>
<td class="summary">Contains terminal type information.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options.WILL Client.options.WILL = nil">Client.options.WILL Client.options.WILL = nil</a></td>
<td class="summary">Contains currently flagged protocols that the Client wants to negotiate.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Client.options.WONT Client.options.WONT = nil">Client.options.WONT Client.options.WONT = nil</a></td>
<td class="summary">Contains currently flagged protocols that the Client doesn't want to negotiate.</td>
</tr>
</table>
<br/>
<br/>
<h2><a name="functions"></a>Functions</h2>
<dl class="function">
<dt><a name="Client:close"></a><strong>Client:close</strong> ()</dt>
<dd>
Close the client's socket.
</dd>
<dt><a name="Client:getAddress"></a><strong>Client:getAddress</strong> ()</dt>
<dd>
Retreive the client's remote address.
<h3>Return value:</h3>
<ul>The client's remote address.</ul>
</dd>
<dt><a name="Client:getDo"></a><strong>Client:getDo</strong> (op)</dt>
<dd>
Check if the client expects us to negotiate this option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>:
</li>
</ul>
<h3>Return value:</h3>
<ul>true if option is currently negotiated.<br/>false otherwise.</ul>
</dd>
<dt><a name="Client:getDont"></a><strong>Client:getDont</strong> (op)</dt>
<dd>
Check if the client expects us not to negotiate this option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>:
</li>
</ul>
<h3>Return value:</h3>
<ul>true if option is currently not negotiated.<br/>false otherwise.</ul>
</dd>
<dt><a name="Client:getSocket"></a><strong>Client:getSocket</strong> ()</dt>
<dd>
Retreive the client's socket.
<h3>Return value:</h3>
<ul>The Client's socket.</br>nil if no socket is attached.</ul>
</dd>
<dt><a name="Client:getTerminalType"></a><strong>Client:getTerminalType</strong> ()</dt>
<dd>
Retreive the client's terminal type, if applicable.
<h3>Return value:</h3>
<ul>A string representing the type of terminal.</ul>
</dd>
<dt><a name="Client:getWill"></a><strong>Client:getWill</strong> (op)</dt>
<dd>
Check if we will negotiate the given option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>:
</li>
</ul>
<h3>Return value:</h3>
<ul>true if option is currently negotiated.<br/>false otherwise.</ul>
</dd>
<dt><a name="Client:getWont"></a><strong>Client:getWont</strong> (op)</dt>
<dd>
Check if we will not negotiate the given option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>:
</li>
</ul>
<h3>Return value:</h3>
<ul>true if option is currently not negotiated.<br/>false otherwise.</ul>
</dd>
<dt><a name="Client:initialize"></a><strong>Client:initialize</strong> (socket, updateOptions)</dt>
<dd>
Associates a socket with the Client.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>socket</em></code>: The socket to be associated.
</li>
<li>
<code><em>updateOptions</em></code>: Tell the client which options we support.
</li>
</ul>
</dd>
<dt><a name="Client:onDo"></a><strong>Client:onDo</strong> (op)</dt>
<dd>
What to do when receiving an IAC DO option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Client wants the Server to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:onDont"></a><strong>Client:onDont</strong> (op)</dt>
<dd>
What to do when receiving an IAC DONT option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Client doesn't want the Server to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:onSubnegotiation"></a><strong>Client:onSubnegotiation</strong> (negotiation)</dt>
<dd>
What to do when receiving an IAC SE subnegotiation.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>negotiation</em></code>: The entirety of the subnegotiation message.
</li>
</ul>
</dd>
<dt><a name="Client:onWill"></a><strong>Client:onWill</strong> (op)</dt>
<dd>
What to do when receiving an IAC WILL option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Client wants to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:onWont"></a><strong>Client:onWont</strong> (op)</dt>
<dd>
What to do when receiving an IAC WONT option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Client doesn't want to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:receive"></a><strong>Client:receive</strong> (pattern, prefix)</dt>
<dd>
Pipe to socket's receive() function. Telnet protocol processing is handled before values are returned.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>pattern</em></code>:
</li>
<li>
<code><em>prefix</em></code>:
</li>
</ul>
<h3>Return value:</h3>
<ul>If successful, returns the received pattern.<br/>In case of error, the method returns nil followed by an error message.</ul>
</dd>
<dt><a name="Client:send"></a><strong>Client:send</strong> (data, i, j)</dt>
<dd>
Pipe to socket's send() function.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>data</em></code>:
</li>
<li>
<code><em>i</em></code>:
</li>
<li>
<code><em>j</em></code>:
</li>
</ul>
<h3>Return value:</h3>
<ul>If successful, returns number of bytes written.<br/>In case of error, the method returns nil followed by an error message, followed by the number of bytes that were written before failure.</ul>
</dd>
<dt><a name="Client:sendDo"></a><strong>Client:sendDo</strong> (op)</dt>
<dd>
Send an IAC DO message with the given option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Server wants the Client to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:sendDont"></a><strong>Client:sendDont</strong> (op)</dt>
<dd>
Send an IAC DONT message with the given option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Server doesn't wnat the Client to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:sendLine"></a><strong>Client:sendLine</strong> (str)</dt>
<dd>
Sends the given string to the client followed by a linebreak.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>str</em></code>: String to be sent.
</li>
</ul>
<h3>Return value:</h3>
<ul>result of self:sendString()</ul>
</dd>
<dt><a name="Client:sendString"></a><strong>Client:sendString</strong> (str)</dt>
<dd>
Formats a string before sending it to the client.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>str</em></code>: String to be sent.
</li>
</ul>
<h3>Return value:</h3>
<ul>result of self:send().</ul>
</dd>
<dt><a name="Client:sendSupportedOptions"></a><strong>Client:sendSupportedOptions</strong> ()</dt>
<dd>
Inform the Client of which options we support. <b>Should be called only once per socket to avoid miscommunications.</b>
</dd>
<dt><a name="Client:sendWill"></a><strong>Client:sendWill</strong> (op)</dt>
<dd>
Send an IAC WILL message with the given option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Server supports and wants the Client to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:sendWont"></a><strong>Client:sendWont</strong> (op)</dt>
<dd>
Send an IAC WONT message with the given option.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>op</em></code>: Option the Server doesn't support and wants the Client not to negotiate.
</li>
</ul>
</dd>
<dt><a name="Client:setSocket"></a><strong>Client:setSocket</strong> (socket)</dt>
<dd>
Manually assign socket.
<h3>Parameters:</h3>
<ul>
<li>
<code><em>socket</em></code>: Socket to assign.
</li>
</ul>
</dd>
<dt><a name="Client:toString"></a><strong>Client:toString</strong> ()</dt>
<dd>
Returns the string-value of the Client.
<h3>Return value:</h3>
<ul>A string in the format of <tt>"client@<client remote address>"</tt>.</ul>
</dd>
</dl>
<h2><a name="tables"></a>Tables</h2>
<dl class="table">
<dt><a name="Client"></a><strong>Client</strong></dt>
<dd>Cloneable that manages user I/O.<br /><br />
<h3>Fields:</h3>
<ul>
<li>
<code><em>socket</em></code>: The socket associated with this Client.
</li>
</ul>
</dd>
<dt><a name="Client.options"></a><strong>Client.options</strong></dt>
<dd>Contains all telnet protocol options on the client.<br /><br />
</dd>
<dt><a name="Client.options.DO Client.options.DO = nil"></a><strong>Client.options.DO Client.options.DO = nil</strong></dt>
<dd>Contains currently flagged options that the Client wants the Server to negotiate.<br /><br />
</dd>
<dt><a name="Client.options.DONT Client.options.DONT = nil"></a><strong>Client.options.DONT Client.options.DONT = nil</strong></dt>
<dd>Contains currently flagged options that the Client doesn't want the Server to negotiate.<br /><br />
</dd>
<dt><a name="Client.options.MCCP2"></a><strong>Client.options.MCCP2</strong></dt>
<dd>Contains MCCP2 zlib streams.<br /><br />
<h3>Fields:</h3>
<ul>
<li>
<code><em>inflater</em></code>: The zlib inflate input stream.
</li>
<li>
<code><em>deflater</em></code>: The zlib deflate output stream.
</li>
<li>
<code><em>deflateBuffer</em></code>: The buffer deflated output is stored in before being sent.
</li>
</ul>
</dd>
<dt><a name="Client.options.TTYPE"></a><strong>Client.options.TTYPE</strong></dt>
<dd>Contains terminal type information.<br /><br />
<h3>Fields:</h3>
<ul>
<li>
<code><em>type</em></code>: The type of terminal the client is using. Client.options.TTYPE = nil
</li>
</ul>
</dd>
<dt><a name="Client.options.WILL Client.options.WILL = nil"></a><strong>Client.options.WILL Client.options.WILL = nil</strong></dt>
<dd>Contains currently flagged protocols that the Client wants to negotiate.<br /><br />
</dd>
<dt><a name="Client.options.WONT Client.options.WONT = nil"></a><strong>Client.options.WONT Client.options.WONT = nil</strong></dt>
<dd>Contains currently flagged protocols that the Client doesn't want to negotiate.<br /><br />
</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>