mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 11:35:22 +09:00
317 lines
11 KiB
HTML
317 lines
11 KiB
HTML
<!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="$(kind=='Topics' and '' or 'nowrap'">
|
|
<li><a href="../modules/config._file_loader.html">config._file_loader</a></li>
|
|
<li><a href="../modules/config.action_buttons.html">config.action_buttons</a></li>
|
|
<li><a href="../modules/config.advanced_start.html">config.advanced_start</a></li>
|
|
<li><a href="../modules/config.death_logger.html">config.death_logger</a></li>
|
|
<li><a href="../modules/config.expcore-commands.auth_admin.html">config.expcore-commands.auth_admin</a></li>
|
|
<li><a href="../modules/config.expcore-commands.auth_roles.html">config.expcore-commands.auth_roles</a></li>
|
|
<li><a href="../modules/config.expcore-commands.auth_runtime_disable.html">config.expcore-commands.auth_runtime_disable</a></li>
|
|
<li><a href="../modules/config.expcore-commands.parse_general.html">config.expcore-commands.parse_general</a></li>
|
|
<li><a href="../modules/config.expcore-commands.parse_roles.html">config.expcore-commands.parse_roles</a></li>
|
|
<li><a href="../modules/config.permission_groups.html">config.permission_groups</a></li>
|
|
<li><a href="../modules/config.popup_messages.html">config.popup_messages</a></li>
|
|
<li><a href="../modules/config.rockets.html">config.rockets</a></li>
|
|
<li><a href="../modules/config.roles.html">config.roles</a></li>
|
|
<li><a href="../modules/config.scorched_earth.html">config.scorched_earth</a></li>
|
|
<li><a href="../modules/config.spawn_area.html">config.spawn_area</a></li>
|
|
<li><a href="../modules/config.warnings.html">config.warnings</a></li>
|
|
<li><a href="../modules/control.html">control</a></li>
|
|
<li><a href="../modules/expcore.commands.html">expcore.commands</a></li>
|
|
<li><a href="../modules/expcore.common.html">expcore.common</a></li>
|
|
<li><a href="../modules/expcore.gui.html">expcore.gui</a></li>
|
|
<li><a href="../modules/expcore.gui.buttons.html">expcore.gui.buttons</a></li>
|
|
<li><a href="../modules/expcore.gui.center.html">expcore.gui.center</a></li>
|
|
<li><a href="../modules/expcore.gui.checkboxs.html">expcore.gui.checkboxs</a></li>
|
|
<li><a href="../modules/expcore.gui.core.html">expcore.gui.core</a></li>
|
|
<li><a href="../modules/expcore.gui.dropdown.html">expcore.gui.dropdown</a></li>
|
|
<li><a href="../modules/expcore.gui.elem-button.html">expcore.gui.elem-button</a></li>
|
|
<li><a href="../modules/expcore.gui.instances.html">expcore.gui.instances</a></li>
|
|
<li><a href="../modules/expcore.gui.left.html">expcore.gui.left</a></li>
|
|
<li><a href="../modules/expcore.gui.popups.html">expcore.gui.popups</a></li>
|
|
<li><a href="../modules/expcore.gui.progress-bar.html">expcore.gui.progress-bar</a></li>
|
|
<li><a href="../modules/expcore.gui.slider.html">expcore.gui.slider</a></li>
|
|
<li><a href="../modules/expcore.gui.test.html">expcore.gui.test</a></li>
|
|
<li><a href="../modules/expcore.gui.text.html">expcore.gui.text</a></li>
|
|
<li><a href="../modules/expcore.gui.toolbar.html">expcore.gui.toolbar</a></li>
|
|
<li><a href="../modules/expcore.permission_groups.html">expcore.permission_groups</a></li>
|
|
<li><a href="../modules/expcore.roles.html">expcore.roles</a></li>
|
|
<li><a href="../modules/expcore.store.html">expcore.store</a></li>
|
|
<li><a href="../modules/modules.addons.advanced-start.html">modules.addons.advanced-start</a></li>
|
|
<li><a href="../modules/modules.addons.chat-popups.html">modules.addons.chat-popups</a></li>
|
|
<li><a href="../modules/modules.addons.damage-popups.html">modules.addons.damage-popups</a></li>
|
|
<li><a href="../modules/modules.gui.player-list.html">modules.gui.player-list</a></li>
|
|
<li><a href="../modules/modules.gui.rocket-info.html">modules.gui.rocket-info</a></li>
|
|
<li><a href="../modules/modules.gui.science-info.html">modules.gui.science-info</a></li>
|
|
<li><a href="../modules/modules.gui.task-list.html">modules.gui.task-list</a></li>
|
|
<li><a href="../modules/utils.alien_evolution_progress.html">utils.alien_evolution_progress</a></li>
|
|
<li><a href="../modules/utils.core.html">utils.core</a></li>
|
|
<li><a href="../modules/utils.debug.html">utils.debug</a></li>
|
|
<li><a href="../modules/utils.event.html">utils.event</a></li>
|
|
<li><a href="../modules/utils.event_core.html">utils.event_core</a></li>
|
|
<li><a href="../modules/utils.math.html">utils.math</a></li>
|
|
<li><a href="../modules/utils.recipe_locker.html">utils.recipe_locker</a></li>
|
|
<li><strong>utils.state_machine</strong></li>
|
|
<li><a href="../modules/utils.table.html">utils.table</a></li>
|
|
<li><a href="../modules/utils.task.html">utils.task</a></li>
|
|
<li><a href="../modules/utils.timestamp.html">utils.timestamp</a></li>
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div id="content">
|
|
|
|
<h1>Module <code>utils.state_machine</code></h1>
|
|
<p>This module provides a classical mealy/moore state machine.</p>
|
|
<p>
|
|
Each machine in constructed by calling new()
|
|
States and Transitions are lazily added to the machine as transition handlers and state tick handlers are registered.
|
|
However the state machine must be fully defined after init is done. Dynamic machine changes are currently unsupported
|
|
An example usage can be found here: map_gen\combined\tetris\control.lua</p>
|
|
|
|
|
|
<h2><a href="#Functions">Functions</a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Module.transition">Module.transition (self, new_state)</a></td>
|
|
<td class="summary">Transitions the supplied machine into a given state and executes all transaction_callbacks</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Module.in_state">Module.in_state (self, state)</a></td>
|
|
<td class="summary">Is this machine in this state?</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Module.machine_tick">Module.machine_tick (self)</a></td>
|
|
<td class="summary">Invoke a machine tick.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Module.register_state_tick_callback">Module.register_state_tick_callback (self, state, callback)</a></td>
|
|
<td class="summary">Register a handler that will be invoked by StateMachine.machine_tick
|
|
You may register multiple handlers for the same transition
|
|
NOTICE: This function will invoke an error if called after init.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Module.register_transition_callback">Module.register_transition_callback (self, state, state, callback)</a></td>
|
|
<td class="summary">Register a handler that will be invoked by StateMachine.transition
|
|
You may register multiple handlers for the same transition
|
|
NOTICE: This function will invoke an error if called after init.</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap><a href="#Module.new">Module.new (init_state)</a></td>
|
|
<td class="summary">Constructs a new state machine</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<h2><a name="Functions"></a>Functions</h2>
|
|
|
|
<dl class="function">
|
|
<dt>
|
|
<a name = "Module.transition"></a>
|
|
<strong>Module.transition (self, new_state)</strong>
|
|
</dt>
|
|
<dd>
|
|
Transitions the supplied machine into a given state and executes all transaction_callbacks
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
StateMachine
|
|
</li>
|
|
<li><span class="parameter">new_state</span>
|
|
number/string The new state to transition to
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Module.in_state"></a>
|
|
<strong>Module.in_state (self, state)</strong>
|
|
</dt>
|
|
<dd>
|
|
Is this machine in this state?
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
StateMachine
|
|
</li>
|
|
<li><span class="parameter">state</span>
|
|
number/string
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
boolean
|
|
</ol>
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Module.machine_tick"></a>
|
|
<strong>Module.machine_tick (self)</strong>
|
|
</dt>
|
|
<dd>
|
|
Invoke a machine tick. Will execute all in_state_callbacks of the given machine
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
StateMachine the machine, whose handlers will be invoked
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Module.register_state_tick_callback"></a>
|
|
<strong>Module.register_state_tick_callback (self, state, callback)</strong>
|
|
</dt>
|
|
<dd>
|
|
Register a handler that will be invoked by StateMachine.machine_tick
|
|
You may register multiple handlers for the same transition
|
|
NOTICE: This function will invoke an error if called after init. Dynamic machine changes are currently unsupported
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
StateMachine the machine
|
|
</li>
|
|
<li><span class="parameter">state</span>
|
|
number/string The state, that the machine will be in, when callback is invoked
|
|
</li>
|
|
<li><span class="parameter">callback</span>
|
|
function
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Module.register_transition_callback"></a>
|
|
<strong>Module.register_transition_callback (self, state, state, callback)</strong>
|
|
</dt>
|
|
<dd>
|
|
Register a handler that will be invoked by StateMachine.transition
|
|
You may register multiple handlers for the same transition
|
|
NOTICE: This function will invoke an error if called after init. Dynamic machine changes are currently unsupported
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">self</span>
|
|
StateMachine the machine
|
|
</li>
|
|
<li><span class="parameter">state</span>
|
|
number/string entering state
|
|
</li>
|
|
<li><span class="parameter">state</span>
|
|
number/string entering state
|
|
</li>
|
|
<li><span class="parameter">callback</span>
|
|
function
|
|
</li>
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
|
|
</dd>
|
|
<dt>
|
|
<a name = "Module.new"></a>
|
|
<strong>Module.new (init_state)</strong>
|
|
</dt>
|
|
<dd>
|
|
Constructs a new state machine
|
|
|
|
|
|
<h3>Parameters:</h3>
|
|
<ul>
|
|
<li><span class="parameter">init_state</span>
|
|
number/string The starting state of the machine
|
|
</li>
|
|
</ul>
|
|
|
|
<h3>Returns:</h3>
|
|
<ol>
|
|
|
|
StateMachine The constructed state machine object
|
|
</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.3</a></i>
|
|
<i style="float:right;">Last updated 2019-05-29 22:30:49 </i>
|
|
</div> <!-- id="about" -->
|
|
</div> <!-- id="container" -->
|
|
</body>
|
|
</html>
|