mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
Doc Added
This commit is contained in:
210
doc/modules/Event.html
Normal file
210
doc/modules/Event.html
Normal file
@@ -0,0 +1,210 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="../ldoc.css" type="text/css" />
|
||||
</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">
|
||||
|
||||
|
||||
<!-- Menu -->
|
||||
|
||||
<div id="navigation">
|
||||
<br/>
|
||||
<h1>ldoc</h1>
|
||||
|
||||
<ul>
|
||||
<li><a href="../index.html">Index</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Contents</h2>
|
||||
<ul>
|
||||
<li><a href="#Functions">Functions</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2>Modules</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../modules/expcore.guiparts.center.html">expcore.guiparts.center</a></li>
|
||||
<li><a href="../modules/expcore.guiparts.inputs.html">expcore.guiparts.inputs</a></li>
|
||||
<li><a href="../modules/expcore.guiparts.left.html">expcore.guiparts.left</a></li>
|
||||
<li><a href="../modules/expcore.guiparts.popup.html">expcore.guiparts.popup</a></li>
|
||||
<li><a href="../modules/expcore.guiparts.toolbar.html">expcore.guiparts.toolbar</a></li>
|
||||
<li><a href="../modules/expcore.commands.html">expcore.commands</a></li>
|
||||
<li><a href="../modules/expcore.gui.html">expcore.gui</a></li>
|
||||
<li><a href="../modules/expcore.ranking.html">expcore.ranking</a></li>
|
||||
<li><a href="../modules/expcore.server.html">expcore.server</a></li>
|
||||
<li><a href="../modules/expcore.sync.html">expcore.sync</a></li>
|
||||
<li><a href="../modules/FSM.html">FSM</a></li>
|
||||
<li><a href="../modules/modules.expgaminglib.control.html">modules.expgaminglib.control</a></li>
|
||||
<li><a href="../modules/defines.color.html">defines.color</a></li>
|
||||
<li><strong>Event</strong></li>
|
||||
<li><a href="../modules/Game.html">Game</a></li>
|
||||
<li><a href="../modules/string.html">string</a></li>
|
||||
<li><a href="../modules/table.html">table</a></li>
|
||||
<li><a href="../modules/defines.time.html">defines.time</a></li>
|
||||
</ul>
|
||||
<h2>Scripts</h2>
|
||||
<ul class="nowrap">
|
||||
<li><a href="../scripts/control.lua.html">control.lua</a></li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<h1>Module <code>Event</code></h1>
|
||||
<p>Makes working with events in factorio a lot more simple.</p>
|
||||
<p>
|
||||
<p>Factorio can only have one handler registered per event. This module
|
||||
allows you to easily register multiple handlers for each event.
|
||||
Using this module is as simple as replacing script.on_event(...) with Event.register(...)</p></p>
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">require('stdlib/event/event')
|
||||
</pre>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a href="#Functions">Functions</a></h2>
|
||||
<table class="function_list">
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#register">register (event, handler)</a></td>
|
||||
<td class="summary">Registers a function for a given event.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#dispatch">dispatch (event)</a></td>
|
||||
<td class="summary">Calls the registerd handlers
|
||||
Will stop dispatching remaning handlers if any handler passes invalid event userdata.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name" nowrap><a href="#remove">remove (event, handler)</a></td>
|
||||
<td class="summary">Removes the handler from the event.</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
|
||||
|
||||
<dl class="function">
|
||||
<dt>
|
||||
<a name = "register"></a>
|
||||
<strong>register (event, handler)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Registers a function for a given event. If a nil handler is passed remove all events and stop listening for that event.
|
||||
Events are dispatched in the order they are registered.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><span class="type">defines.events</span> or <span class="type">{defines.events,...}</span></span>
|
||||
events to register
|
||||
</li>
|
||||
<li><span class="parameter">handler</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
Function to call when event is triggered
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
<span class="types"><span class="type">Event</span></span>
|
||||
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
<h3>Usage:</h3>
|
||||
<ul>
|
||||
<pre class="example">Event.register(defines.events.on_tick, <span class="keyword">function</span>(event) <span class="global">print</span> event.tick <span class="keyword">end</span>)
|
||||
<span class="comment">-- creates an event that prints the current tick every tick.</span></pre>
|
||||
</ul>
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "dispatch"></a>
|
||||
<strong>dispatch (event)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Calls the registerd handlers
|
||||
Will stop dispatching remaning handlers if any handler passes invalid event userdata.
|
||||
Handlers are dispatched in the order they were created
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
|
||||
LuaEvent as created by script.raise_event
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<h3>See also:</h3>
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
|
||||
</dd>
|
||||
<dt>
|
||||
<a name = "remove"></a>
|
||||
<strong>remove (event, handler)</strong>
|
||||
</dt>
|
||||
<dd>
|
||||
Removes the handler from the event. If it removes the last handler for an event stop listening for that event.
|
||||
|
||||
|
||||
<h3>Parameters:</h3>
|
||||
<ul>
|
||||
<li><span class="parameter">event</span>
|
||||
<span class="types"><span class="type">defines.events</span> or <span class="type">{defines.events,...}</span></span>
|
||||
events to remove the handler for
|
||||
</li>
|
||||
<li><span class="parameter">handler</span>
|
||||
<span class="types"><span class="type">function</span></span>
|
||||
to remove
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>Returns:</h3>
|
||||
<ol>
|
||||
|
||||
Event
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
</div> <!-- id="main" -->
|
||||
<div id="about">
|
||||
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
|
||||
<i style="float:right;">Last updated 2018-05-29 20:06:55 </i>
|
||||
</div> <!-- id="about" -->
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user