Added docs

* Added a "nothing docstring" at the top of each file we want to generate docs for. We have to do this or ldoc just straight up refuses to generate docs otherwise.
* Fixed up a few incorrect docstrings
* config.ld is the config file for ldoc

These still need some work: a bunch of functions are still undocumented and also: type.lua & run.lua are completely undocumented.
This commit is contained in:
Josh Perry 2018-09-25 18:47:20 +01:00
parent d53a931c3a
commit 67d67aad5f
17 changed files with 2195 additions and 3 deletions

3
config.ld Normal file
View file

@ -0,0 +1,3 @@
project = 'Concord'
description = 'A feature-complete ECS library'
file = {'lib', exclude = {'lib/type.lua', 'lib/run.lua'}}

90
doc/index.html Normal file
View file

@ -0,0 +1,90 @@
<!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>Concord</h1>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="modules/component.html">component</a></li>
<li><a href="modules/entity.html">entity</a></li>
<li><a href="modules/init.html">init</a></li>
<li><a href="modules/instance.html">instance</a></li>
<li><a href="modules/list.html">list</a></li>
<li><a href="modules/pool.html">pool</a></li>
<li><a href="modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h2>A feature-complete ECS library</h2>
<h2>Modules</h2>
<table class="module_list">
<tr>
<td class="name" nowrap><a href="modules/component.html">component</a></td>
<td class="summary">Component</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/entity.html">entity</a></td>
<td class="summary">Entity</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/init.html">init</a></td>
<td class="summary">init</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/instance.html">instance</a></td>
<td class="summary">Instance</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/list.html">list</a></td>
<td class="summary">List</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/pool.html">pool</a></td>
<td class="summary">Pool</td>
</tr>
<tr>
<td class="name" nowrap><a href="modules/system.html">system</a></td>
<td class="summary">System</td>
</tr>
</table>
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

303
doc/ldoc.css Normal file
View file

@ -0,0 +1,303 @@
/* BEGIN RESET
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.8.2r1
*/
html {
color: #000;
background: #FFF;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td {
margin: 0;
padding: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0;
}
address,caption,cite,code,dfn,em,strong,th,var,optgroup {
font-style: inherit;
font-weight: inherit;
}
del,ins {
text-decoration: none;
}
li {
margin-left: 20px;
}
caption,th {
text-align: left;
}
h1,h2,h3,h4,h5,h6 {
font-size: 100%;
font-weight: bold;
}
q:before,q:after {
content: '';
}
abbr,acronym {
border: 0;
font-variant: normal;
}
sup {
vertical-align: baseline;
}
sub {
vertical-align: baseline;
}
legend {
color: #000;
}
input,button,textarea,select,optgroup,option {
font-family: inherit;
font-size: inherit;
font-style: inherit;
font-weight: inherit;
}
input,button,textarea,select {*font-size:100%;
}
/* END RESET */
body {
margin-left: 1em;
margin-right: 1em;
font-family: arial, helvetica, geneva, sans-serif;
background-color: #ffffff; margin: 0px;
}
code, tt { font-family: monospace; font-size: 1.1em; }
span.parameter { font-family:monospace; }
span.parameter:after { content:":"; }
span.types:before { content:"("; }
span.types:after { content:")"; }
.type { font-weight: bold; font-style:italic }
body, p, td, th { font-size: .95em; line-height: 1.2em;}
p, ul { margin: 10px 0 0 0px;}
strong { font-weight: bold;}
em { font-style: italic;}
h1 {
font-size: 1.5em;
margin: 20px 0 20px 0;
}
h2, h3, h4 { margin: 15px 0 10px 0; }
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;
background: #00007f;
height: 1px;
}
blockquote { margin-left: 3em; }
ul { list-style-type: disc; }
p.name {
font-family: "Andale Mono", monospace;
padding-top: 1em;
}
pre {
background-color: rgb(245, 245, 245);
border: 1px solid #C0C0C0; /* silver */
padding: 10px;
margin: 10px 0 10px 0;
overflow: auto;
font-family: "Andale Mono", monospace;
}
pre.example {
font-size: .85em;
}
table.index { border: 1px #00007f; }
table.index td { text-align: left; vertical-align: top; }
#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;
}
#main {
background-color: #f0f0f0;
border-left: 2px solid #cccccc;
}
#navigation {
float: left;
width: 14em;
vertical-align: top;
background-color: #f0f0f0;
overflow: visible;
}
#navigation h2 {
background-color:#e7e7e7;
font-size:1.1em;
color:#000000;
text-align: left;
padding:0.2em;
border-top:1px solid #dddddd;
border-bottom:1px solid #dddddd;
}
#navigation ul
{
font-size:1em;
list-style-type: none;
margin: 1px 1px 10px 1px;
}
#navigation li {
text-indent: -1em;
display: block;
margin: 3px 0px 0px 22px;
}
#navigation li li a {
margin: 0px 3px 0px -1em;
}
#content {
margin-left: 14em;
padding: 1em;
width: 700px;
border-left: 2px solid #cccccc;
border-right: 2px solid #cccccc;
background-color: #ffffff;
}
#about {
clear: both;
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 {
padding: 1em;
background-color: #ffffff;
}
#navigation {
display: none;
}
pre.example {
font-family: "Andale Mono", monospace;
font-size: 10pt;
page-break-inside: avoid;
}
}
table.module_list {
border-width: 1px;
border-style: solid;
border-color: #cccccc;
border-collapse: collapse;
}
table.module_list td {
border-width: 1px;
padding: 3px;
border-style: solid;
border-color: #cccccc;
}
table.module_list td.name { background-color: #f0f0f0; min-width: 200px; }
table.module_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; min-width: 200px; }
table.function_list td.summary { width: 100%; }
ul.nowrap {
overflow:auto;
white-space:nowrap;
}
dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;}
dl.table h3, dl.function h3 {font-size: .95em;}
/* stop sublists from having initial vertical space */
ul ul { margin-top: 0px; }
ol ul { margin-top: 0px; }
ol ol { margin-top: 0px; }
ul ol { margin-top: 0px; }
/* make the target distinct; helps when we're navigating to a function */
a:target + * {
background-color: #FF9;
}
/* styles for prettification of source */
pre .comment { color: #558817; }
pre .constant { color: #a8660d; }
pre .escape { color: #844631; }
pre .keyword { color: #aa5050; font-weight: bold; }
pre .library { color: #0e7c6b; }
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
pre .string { color: #8080ff; }
pre .number { color: #f8660d; }
pre .operator { color: #2239a8; font-weight: bold; }
pre .preprocessor, pre .prepro { color: #a33243; }
pre .global { color: #800080; }
pre .user-keyword { color: #800080; }
pre .prompt { color: #558817; }
pre .url { color: #272fc2; text-decoration: underline; }

139
doc/modules/component.html Normal file
View file

@ -0,0 +1,139 @@
<!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>Concord</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><strong>component</strong></li>
<li><a href="../modules/entity.html">entity</a></li>
<li><a href="../modules/init.html">init</a></li>
<li><a href="../modules/instance.html">instance</a></li>
<li><a href="../modules/list.html">list</a></li>
<li><a href="../modules/pool.html">pool</a></li>
<li><a href="../modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>component</code></h1>
<p>Component</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Component.new">Component.new (populate)</a></td>
<td class="summary">Creates a new Component.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Component:__initialize">Component:__initialize (...)</a></td>
<td class="summary">Creates and initializes a new Bag.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Component.new"></a>
<strong>Component.new (populate)</strong>
</dt>
<dd>
Creates a new Component.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">populate</span>
A function that populates the Bag with values
</li>
</ul>
<h3>Returns:</h3>
<ol>
A Component object
</ol>
</dd>
<dt>
<a name = "Component:__initialize"></a>
<strong>Component:__initialize (...)</strong>
</dt>
<dd>
Creates and initializes a new Bag.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
The values passed to the populate function
</li>
</ul>
<h3>Returns:</h3>
<ol>
A new initialized Bag
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

269
doc/modules/entity.html Normal file
View file

@ -0,0 +1,269 @@
<!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>Concord</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/component.html">component</a></li>
<li><strong>entity</strong></li>
<li><a href="../modules/init.html">init</a></li>
<li><a href="../modules/instance.html">instance</a></li>
<li><a href="../modules/list.html">list</a></li>
<li><a href="../modules/pool.html">pool</a></li>
<li><a href="../modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>entity</code></h1>
<p>Entity</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Entity.new">Entity.new ()</a></td>
<td class="summary">Creates and initializes a new Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity:give">Entity:give (component, ...)</a></td>
<td class="summary">Gives an Entity a component with values.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity:remove">Entity:remove (component)</a></td>
<td class="summary">Removes a component from an Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity:apply">Entity:apply ()</a></td>
<td class="summary">Checks the Entity against the pools again.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity:destroy">Entity:destroy ()</a></td>
<td class="summary">Destroys the Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity:get">Entity:get (component)</a></td>
<td class="summary">Gets a Component from the Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Entity:has">Entity:has (component)</a></td>
<td class="summary">Returns true if the Entity has the Component.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Entity.new"></a>
<strong>Entity.new ()</strong>
</dt>
<dd>
Creates and initializes a new Entity.
<h3>Returns:</h3>
<ol>
A new Entity
</ol>
</dd>
<dt>
<a name = "Entity:give"></a>
<strong>Entity:give (component, ...)</strong>
</dt>
<dd>
Gives an Entity a component with values.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">component</span>
The Component to add
</li>
<li><span class="parameter">...</span>
The values passed to the Component
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Entity:remove"></a>
<strong>Entity:remove (component)</strong>
</dt>
<dd>
Removes a component from an Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">component</span>
The Component to remove
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Entity:apply"></a>
<strong>Entity:apply ()</strong>
</dt>
<dd>
Checks the Entity against the pools again.
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Entity:destroy"></a>
<strong>Entity:destroy ()</strong>
</dt>
<dd>
Destroys the Entity.
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Entity:get"></a>
<strong>Entity:get (component)</strong>
</dt>
<dd>
Gets a Component from the Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">component</span>
The Component to get
</li>
</ul>
<h3>Returns:</h3>
<ol>
The Bag from the Component
</ol>
</dd>
<dt>
<a name = "Entity:has"></a>
<strong>Entity:has (component)</strong>
</dt>
<dd>
Returns true if the Entity has the Component.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">component</span>
The Component to check against
</li>
</ul>
<h3>Returns:</h3>
<ol>
True if the entity has the Bag. False otherwise
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

112
doc/modules/init.html Normal file
View file

@ -0,0 +1,112 @@
<!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>Concord</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/component.html">component</a></li>
<li><a href="../modules/entity.html">entity</a></li>
<li><strong>init</strong></li>
<li><a href="../modules/instance.html">instance</a></li>
<li><a href="../modules/list.html">list</a></li>
<li><a href="../modules/pool.html">pool</a></li>
<li><a href="../modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>init</code></h1>
<p>init</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Concord.init">Concord.init (settings)</a></td>
<td class="summary">Initializes the library with some optional settings</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Concord.init"></a>
<strong>Concord.init (settings)</strong>
</dt>
<dd>
Initializes the library with some optional settings
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">settings</span>
Table of settings: {
useEvents Flag to overwrite love.run and use events. Defaults to false
}
</li>
</ul>
<h3>Returns:</h3>
<ol>
Concord
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

463
doc/modules/instance.html Normal file
View file

@ -0,0 +1,463 @@
<!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>Concord</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/component.html">component</a></li>
<li><a href="../modules/entity.html">entity</a></li>
<li><a href="../modules/init.html">init</a></li>
<li><strong>instance</strong></li>
<li><a href="../modules/list.html">list</a></li>
<li><a href="../modules/pool.html">pool</a></li>
<li><a href="../modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>instance</code></h1>
<p>Instance</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Instance.new">Instance.new ()</a></td>
<td class="summary">Creates a new Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:addEntity">Instance:addEntity (e)</a></td>
<td class="summary">Adds an Entity to the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:checkEntity">Instance:checkEntity (e)</a></td>
<td class="summary">Checks an Entity against all the systems in the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:removeEntity">Instance:removeEntity (e)</a></td>
<td class="summary">Marks an Entity as removed from the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:flush">Instance:flush ()</a></td>
<td class="summary">Completely removes all marked Entities in the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:addSystem">Instance:addSystem (system, eventName, callback, enabled)</a></td>
<td class="summary">Adds a System to the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:enableSystem">Instance:enableSystem (system, eventName, callback)</a></td>
<td class="summary">Enables a System in the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:disableSystem">Instance:disableSystem (system, eventName, callback)</a></td>
<td class="summary">Disables a System in the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:setSystem">Instance:setSystem (system, eventName, callback, enable)</a></td>
<td class="summary">Sets a System 'enable' in the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:emit">Instance:emit (eventName, ...)</a></td>
<td class="summary">Emits an Event in the Instance.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:clear">Instance:clear ()</a></td>
<td class="summary">Removes all entities from the Instance</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:onEntityAdded">Instance:onEntityAdded (e)</a></td>
<td class="summary">Default callback for adding an Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Instance:onEntityRemoved">Instance:onEntityRemoved (e)</a></td>
<td class="summary">Default callback for removing an Entity.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Instance.new"></a>
<strong>Instance.new ()</strong>
</dt>
<dd>
Creates a new Instance.
<h3>Returns:</h3>
<ol>
The new instance
</ol>
</dd>
<dt>
<a name = "Instance:addEntity"></a>
<strong>Instance:addEntity (e)</strong>
</dt>
<dd>
Adds an Entity to the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to add
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:checkEntity"></a>
<strong>Instance:checkEntity (e)</strong>
</dt>
<dd>
Checks an Entity against all the systems in the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to check
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:removeEntity"></a>
<strong>Instance:removeEntity (e)</strong>
</dt>
<dd>
Marks an Entity as removed from the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to mark
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:flush"></a>
<strong>Instance:flush ()</strong>
</dt>
<dd>
Completely removes all marked Entities in the Instance.
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:addSystem"></a>
<strong>Instance:addSystem (system, eventName, callback, enabled)</strong>
</dt>
<dd>
Adds a System to the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">system</span>
The System to add
</li>
<li><span class="parameter">eventName</span>
The Event to register to
</li>
<li><span class="parameter">callback</span>
The function name to call. Defaults to eventName
</li>
<li><span class="parameter">enabled</span>
If the system is enabled. Defaults to true
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:enableSystem"></a>
<strong>Instance:enableSystem (system, eventName, callback)</strong>
</dt>
<dd>
Enables a System in the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">system</span>
The System to enable
</li>
<li><span class="parameter">eventName</span>
The Event it was registered to
</li>
<li><span class="parameter">callback</span>
The callback it was registered with. Defaults to eventName
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:disableSystem"></a>
<strong>Instance:disableSystem (system, eventName, callback)</strong>
</dt>
<dd>
Disables a System in the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">system</span>
The System to disable
</li>
<li><span class="parameter">eventName</span>
The Event it was registered to
</li>
<li><span class="parameter">callback</span>
The callback it was registered with. Defaults to eventName
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:setSystem"></a>
<strong>Instance:setSystem (system, eventName, callback, enable)</strong>
</dt>
<dd>
Sets a System 'enable' in the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">system</span>
The System to set
</li>
<li><span class="parameter">eventName</span>
The Event it was registered to
</li>
<li><span class="parameter">callback</span>
The callback it was registered with. Defaults to eventName
</li>
<li><span class="parameter">enable</span>
The state to set it to
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:emit"></a>
<strong>Instance:emit (eventName, ...)</strong>
</dt>
<dd>
Emits an Event in the Instance.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">eventName</span>
The Event that should be emitted
</li>
<li><span class="parameter">...</span>
Parameters passed to listeners
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:clear"></a>
<strong>Instance:clear ()</strong>
</dt>
<dd>
Removes all entities from the Instance
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "Instance:onEntityAdded"></a>
<strong>Instance:onEntityAdded (e)</strong>
</dt>
<dd>
Default callback for adding an Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity that was added
</li>
</ul>
</dd>
<dt>
<a name = "Instance:onEntityRemoved"></a>
<strong>Instance:onEntityRemoved (e)</strong>
</dt>
<dd>
Default callback for removing an Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity that was removed
</li>
</ul>
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

239
doc/modules/list.html Normal file
View file

@ -0,0 +1,239 @@
<!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>Concord</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/component.html">component</a></li>
<li><a href="../modules/entity.html">entity</a></li>
<li><a href="../modules/init.html">init</a></li>
<li><a href="../modules/instance.html">instance</a></li>
<li><strong>list</strong></li>
<li><a href="../modules/pool.html">pool</a></li>
<li><a href="../modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>list</code></h1>
<p>List</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#List.new">List.new ()</a></td>
<td class="summary">Creates a new List.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#List:clear">List:clear ()</a></td>
<td class="summary">Clears the List completely.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#List:add">List:add (obj)</a></td>
<td class="summary">Adds an object to the List.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#List:remove">List:remove (obj)</a></td>
<td class="summary">Removes an object from the List.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#List:get">List:get (index)</a></td>
<td class="summary">Gets an object by numerical index.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#List:has">List:has (obj)</a></td>
<td class="summary">Gets if the List has the object.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "List.new"></a>
<strong>List.new ()</strong>
</dt>
<dd>
Creates a new List.
<h3>Returns:</h3>
<ol>
A new list
</ol>
</dd>
<dt>
<a name = "List:clear"></a>
<strong>List:clear ()</strong>
</dt>
<dd>
Clears the List completely.
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "List:add"></a>
<strong>List:add (obj)</strong>
</dt>
<dd>
Adds an object to the List.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
The object to add
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "List:remove"></a>
<strong>List:remove (obj)</strong>
</dt>
<dd>
Removes an object from the List.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
The object to remove
</li>
</ul>
<h3>Returns:</h3>
<ol>
self
</ol>
</dd>
<dt>
<a name = "List:get"></a>
<strong>List:get (index)</strong>
</dt>
<dd>
Gets an object by numerical index.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">index</span>
The index to look at
</li>
</ul>
<h3>Returns:</h3>
<ol>
The object at the index
</ol>
</dd>
<dt>
<a name = "List:has"></a>
<strong>List:has (obj)</strong>
</dt>
<dd>
Gets if the List has the object.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">obj</span>
The object to search for
true if the list has the object, false otherwise
</li>
</ul>
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

142
doc/modules/pool.html Normal file
View file

@ -0,0 +1,142 @@
<!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>Concord</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/component.html">component</a></li>
<li><a href="../modules/entity.html">entity</a></li>
<li><a href="../modules/init.html">init</a></li>
<li><a href="../modules/instance.html">instance</a></li>
<li><a href="../modules/list.html">list</a></li>
<li><strong>pool</strong></li>
<li><a href="../modules/system.html">system</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>pool</code></h1>
<p>Pool</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#Pool.new">Pool.new (name, filter)</a></td>
<td class="summary">Creates a new Pool</td>
</tr>
<tr>
<td class="name" nowrap><a href="#Pool:eligible">Pool:eligible (e)</a></td>
<td class="summary">Checks if an Entity is eligible for the Pool.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "Pool.new"></a>
<strong>Pool.new (name, filter)</strong>
</dt>
<dd>
Creates a new Pool
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
Identifier for the Pool.
</li>
<li><span class="parameter">filter</span>
Table containing the required Components
</li>
</ul>
<h3>Returns:</h3>
<ol>
The new Pool
</ol>
</dd>
<dt>
<a name = "Pool:eligible"></a>
<strong>Pool:eligible (e)</strong>
</dt>
<dd>
Checks if an Entity is eligible for the Pool.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to check
</li>
</ul>
<h3>Returns:</h3>
<ol>
True if the entity is eligible, false otherwise
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

418
doc/modules/system.html Normal file
View file

@ -0,0 +1,418 @@
<!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>Concord</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/component.html">component</a></li>
<li><a href="../modules/entity.html">entity</a></li>
<li><a href="../modules/init.html">init</a></li>
<li><a href="../modules/instance.html">instance</a></li>
<li><a href="../modules/list.html">list</a></li>
<li><a href="../modules/pool.html">pool</a></li>
<li><strong>system</strong></li>
</ul>
</div>
<div id="content">
<h1>Module <code>system</code></h1>
<p>System</p>
<p></p>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#System.new">System.new (...)</a></td>
<td class="summary">Creates a new System prototype.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:__buildPool">System:__buildPool (baseFilter)</a></td>
<td class="summary">Builds a Pool for the System.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:__check">System:__check (e)</a></td>
<td class="summary">Checks and applies an Entity to the System's pools.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:__remove">System:__remove (e)</a></td>
<td class="summary">Removed an Entity from the System.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:__tryAdd">System:__tryAdd (e)</a></td>
<td class="summary">Tries to add an Entity to the System.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:__tryRemove">System:__tryRemove (e)</a></td>
<td class="summary">Tries to remove an Entity from the System.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:getInstance">System:getInstance ()</a></td>
<td class="summary">Returns the Instance the System is in.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:__has">System:__has (e)</a></td>
<td class="summary">Returns if the System has the Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:init">System:init (...)</a></td>
<td class="summary">Default callback for system initialization.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:entityAdded">System:entityAdded (e)</a></td>
<td class="summary">Default callback for adding an Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:entityAddedTo">System:entityAddedTo (e, pool)</a></td>
<td class="summary">Default callback for adding an Entity to a pool.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:entityRemoved">System:entityRemoved (e)</a></td>
<td class="summary">Default callback for removing an Entity.</td>
</tr>
<tr>
<td class="name" nowrap><a href="#System:entityRemovedFrom">System:entityRemovedFrom (e, pool)</a></td>
<td class="summary">Default callback for removing an Entity from a pool.</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "System.new"></a>
<strong>System.new (...)</strong>
</dt>
<dd>
Creates a new System prototype.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
Variable amounts of filters
</li>
</ul>
<h3>Returns:</h3>
<ol>
A new System prototype
</ol>
</dd>
<dt>
<a name = "System:__buildPool"></a>
<strong>System:__buildPool (baseFilter)</strong>
</dt>
<dd>
Builds a Pool for the System.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">baseFilter</span>
The 'raw' Filter
</li>
</ul>
<h3>Returns:</h3>
<ol>
A new Pool
</ol>
</dd>
<dt>
<a name = "System:__check"></a>
<strong>System:__check (e)</strong>
</dt>
<dd>
Checks and applies an Entity to the System's pools.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to check
</li>
</ul>
<h3>Returns:</h3>
<ol>
True if the Entity was added, false if it was removed. Nil if nothing happend
</ol>
</dd>
<dt>
<a name = "System:__remove"></a>
<strong>System:__remove (e)</strong>
</dt>
<dd>
Removed an Entity from the System.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to remove
</li>
</ul>
</dd>
<dt>
<a name = "System:__tryAdd"></a>
<strong>System:__tryAdd (e)</strong>
</dt>
<dd>
Tries to add an Entity to the System.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to add
</li>
</ul>
</dd>
<dt>
<a name = "System:__tryRemove"></a>
<strong>System:__tryRemove (e)</strong>
</dt>
<dd>
Tries to remove an Entity from the System.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to remove
</li>
</ul>
</dd>
<dt>
<a name = "System:getInstance"></a>
<strong>System:getInstance ()</strong>
</dt>
<dd>
Returns the Instance the System is in.
<h3>Returns:</h3>
<ol>
The Instance
</ol>
</dd>
<dt>
<a name = "System:__has"></a>
<strong>System:__has (e)</strong>
</dt>
<dd>
Returns if the System has the Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity to check for
</li>
</ul>
<h3>Returns:</h3>
<ol>
True if the System has the Entity. False otherwise
</ol>
</dd>
<dt>
<a name = "System:init"></a>
<strong>System:init (...)</strong>
</dt>
<dd>
Default callback for system initialization.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">...</span>
Varags
</li>
</ul>
</dd>
<dt>
<a name = "System:entityAdded"></a>
<strong>System:entityAdded (e)</strong>
</dt>
<dd>
Default callback for adding an Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity that was added
</li>
</ul>
</dd>
<dt>
<a name = "System:entityAddedTo"></a>
<strong>System:entityAddedTo (e, pool)</strong>
</dt>
<dd>
Default callback for adding an Entity to a pool.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity that was added
</li>
<li><span class="parameter">pool</span>
The pool the Entity was added to
</li>
</ul>
</dd>
<dt>
<a name = "System:entityRemoved"></a>
<strong>System:entityRemoved (e)</strong>
</dt>
<dd>
Default callback for removing an Entity.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity that was removed
</li>
</ul>
</dd>
<dt>
<a name = "System:entityRemovedFrom"></a>
<strong>System:entityRemovedFrom (e, pool)</strong>
</dt>
<dd>
Default callback for removing an Entity from a pool.
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">e</span>
The Entity that was removed
</li>
<li><span class="parameter">pool</span>
The pool the Entity was removed from
</li>
</ul>
</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-09-25 18:42:43 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View file

@ -1,3 +1,5 @@
--- Component
local Component = {}
Component.__index = Component

View file

@ -1,3 +1,5 @@
--- Entity
local PATH = (...):gsub('%.[^%.]+$', '')
local Type = require(PATH..".type")
@ -87,7 +89,7 @@ function Entity:get(component)
end
--- Returns true if the Entity has the Component.
-- @params component The Component to check against
-- @param component The Component to check against
-- @return True if the entity has the Bag. False otherwise
function Entity:has(component)
if not Type.isComponent(component) then

View file

@ -1,3 +1,5 @@
--- init
local PATH = (...):gsub('%.init$', '')
local Type = require(PATH..".type")

View file

@ -1,3 +1,5 @@
--- Instance
local PATH = (...):gsub('%.[^%.]+$', '')
local Entity = require(PATH..".entity")

View file

@ -1,3 +1,5 @@
--- List
local List = {}
local mt = {__index = List}
@ -66,7 +68,7 @@ end
--- Gets if the List has the object.
-- @param obj The object to search for
-- @param true if the list has the object, false otherwise
-- true if the list has the object, false otherwise
function List:has(obj)
return self.pointers[obj] and true
end

View file

@ -1,3 +1,5 @@
--- Pool
local PATH = (...):gsub('%.[^%.]+$', '')
local List = require(PATH..".list")

View file

@ -1,3 +1,5 @@
--- System
local PATH = (...):gsub('%.[^%.]+$', '')
local Component = require(PATH..".component")
@ -129,7 +131,7 @@ function System:getInstance()
end
--- Returns if the System has the Entity.
-- @param The Entity to check for
-- @param e The Entity to check for
-- @return True if the System has the Entity. False otherwise
function System:__has(e)
return self.__all[e] and true