Added module: ExpGamingCore.Commands

This commit is contained in:
Cooldude2606
2018-06-05 19:32:29 +01:00
parent 6272e29606
commit 9be85f04a6
31 changed files with 686 additions and 289 deletions

View File

@@ -69,6 +69,7 @@ end
Manager.verbose = function(rtn,action) Manager.verbose = function(rtn,action)
local settings = Manager.setVerbose local settings = Manager.setVerbose
local state = Manager.currentState local state = Manager.currentState
if Manager.error and state == Manager.error.__crash then return end
-- if ran in a module the the global module_name is present -- if ran in a module the the global module_name is present
local rtn = type(rtn) == table and serpent.line(rtn) or tostring(rtn) local rtn = type(rtn) == table and serpent.line(rtn) or tostring(rtn)
if module_name then rtn='['..module_name..'] '..rtn if module_name then rtn='['..module_name..'] '..rtn
@@ -341,6 +342,7 @@ Manager.loadModules = setmetatable({},
-- @usage #Manager.error -- returns the number of error handlers that are present -- @usage #Manager.error -- returns the number of error handlers that are present
-- @usage pairs(Manager.error) -- loops over only the error handlers handler_name,hander -- @usage pairs(Manager.error) -- loops over only the error handlers handler_name,hander
Manager.error = setmetatable({ Manager.error = setmetatable({
__crash=false,
__error_call=error, __error_call=error,
__error_const={}, __error_const={},
__error_handler=function(handler_name,callback) __error_handler=function(handler_name,callback)
@@ -400,7 +402,7 @@ Manager.error = setmetatable({
local function next_pair(tbl,k) local function next_pair(tbl,k)
local v local v
k, v = next(tbl, k) k, v = next(tbl, k)
if k == '__error_call' or k == '__error_const' or k == '__error_handler' then return next_pair(tbl,k) end if k == '__error_call' or k == '__error_const' or k == '__error_handler' or k == '__crash' then return next_pair(tbl,k) end
if type(v) == 'function' then return k,v end if type(v) == 'function' then return k,v end
end end
return next_pair, tbl, nil return next_pair, tbl, nil
@@ -437,6 +439,7 @@ Manager.event = setmetatable({
},{ },{
__metatable=false, __metatable=false,
__call=function(tbl,event_name,new_callback,...) __call=function(tbl,event_name,new_callback,...)
if Manager.error.__crash then Manager.error.__error_call('No error handlers loaded; Game not loaded; Forced crash: '..tostring(Manager.error.__crash)) end
-- if no params then return the stop constant -- if no params then return the stop constant
if event_name == nil then return rawget(tbl,'__stop') end if event_name == nil then return rawget(tbl,'__stop') end
-- if the event name is a table then loop over each value in that table -- if the event name is a table then loop over each value in that table

View File

@@ -32,7 +32,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="modules/FSM.html">FSM</a></li> <li><a href="modules/FSM.html">FSM</a></li>
<li><a href="modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -63,8 +63,8 @@
<td class="summary">Factorio Softmod Manager</td> <td class="summary">Factorio Softmod Manager</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></td> <td class="name" nowrap><a href="modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></td>
<td class="summary">Uses a commands data to return the inputs as a string</td> <td class="summary">A full ranking system for factorio.</td>
</tr> </tr>
<tr> <tr>
<td class="name" nowrap><a href="modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></td> <td class="name" nowrap><a href="modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></td>
@@ -132,7 +132,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -0,0 +1,400 @@
<!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>
<li><a href="#Tables">Tables</a></li>
<li><a href="#Fields">Fields</a></li>
</ul>
<h2>Modules</h2>
<ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li>
<li><strong>ExpGamingCore.Commands</strong></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.popup.html">modules.expgamingcore.gui.guiparts.popup</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.toolbar.html">modules.expgamingcore.gui.guiparts.toolbar</a></li>
<li><a href="../modules/modules.expgamingcore.gui.control.html">modules.expgamingcore.gui.control</a></li>
<li><a href="../modules/ExpGamingCore.Ranking.html">ExpGamingCore.Ranking</a></li>
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>ExpGamingCore.Commands</code></h1>
<p>A full ranking system for factorio.</p>
<p></p>
<h3>Info:</h3>
<ul>
<li><strong>License</strong>: https://github.com/explosivegaming/scenario/blob/master/LICENSE</li>
<li><strong>Author</strong>: Cooldude2606</li>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#format_inputs">format_inputs (command)</a></td>
<td class="summary">Returns the inputs of this command as a formated string</td>
</tr>
<tr>
<td class="name" nowrap><a href="#validate_args">validate_args (event)</a></td>
<td class="summary">Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params</td>
</tr>
<tr>
<td class="name" nowrap><a href="#get_commands">get_commands (player)</a></td>
<td class="summary">Used to return all the commands a player can use</td>
</tr>
<tr>
<td class="name" nowrap><a href="#add_command">add_command (name[, description='No Description'][, inputs=an infite string], callback)</a></td>
<td class="summary">Used to define commands</td>
</tr>
</table>
<h2><a href="#Tables">Tables</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#validate">validate</a></td>
<td class="summary">Collection of funcations that can be used to validate inputs</td>
</tr>
</table>
<h2><a href="#Fields">Fields</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#error">error</a></td>
<td class="summary">Used as an error constant for validation</td>
</tr>
<tr>
<td class="name" nowrap><a href="#data">data</a></td>
<td class="summary">Index of all command data</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "format_inputs"></a>
<strong>format_inputs (command)</strong>
</dt>
<dd>
Returns the inputs of this command as a formated string
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">command</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a>, <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a> or <span class="type">event</span></span>
the command to get the inputs of
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the formated string for the inputs
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">commands.format_inputs(<span class="string">'interface'</span>) <span class="comment">-- returns &lt;code&gt; (if you have ExpGamingCore.Server)</span></pre>
</ul>
</dd>
<dt>
<a name = "validate_args"></a>
<strong>validate_args (event)</strong>
</dt>
<dd>
Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params
<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>
this is the event created by add_command not on_console_command
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the error that happend while parsing the args
</ol>
<h3>Or</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
the args for this command
</ol>
<h3>Or</h3>
<ol>
command.error
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">commands.validate_args(event) <span class="comment">-- returns args table</span></pre>
</ul>
</dd>
<dt>
<a name = "get_commands"></a>
<strong>get_commands (player)</strong>
</dt>
<dd>
Used to return all the commands a player can use
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">player</span>
<span class="types"><span class="type">index</span>, <span class="type">name</span> or <span class="type">player</span></span>
the player to test as
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
a table containg all the commands the player can use
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">get_commands(<span class="number">1</span>) <span class="comment">-- return table of command data for each command that the player can use</span></pre>
</ul>
</dd>
<dt>
<a name = "add_command"></a>
<strong>add_command (name[, description='No Description'][, inputs=an infite string], callback)</strong>
</dt>
<dd>
Used to define commands
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">name</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the name of the command
</li>
<li><span class="parameter">description</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the description of the command
(<em>default</em> 'No Description')
</li>
<li><span class="parameter">inputs</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word)
(<em>default</em> an infite string)
</li>
<li><span class="parameter">callback</span>
<span class="types"><span class="type">function</span></span>
the function to call on the event
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example"><span class="comment">--see examples in file</span></pre>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Tables"></a>Tables</h2>
<dl class="function">
<dt>
<a name = "validate"></a>
<strong>validate</strong>
</dt>
<dd>
Collection of funcations that can be used to validate inputs
<h3>Fields:</h3>
<ul>
<li><span class="parameter">__comment</span>
replace _ with - the ldoc did not like me using - in the names
</li>
<li><span class="parameter">string</span>
basicly does nothing but a type filed is required
</li>
<li><span class="parameter">string_inf</span>
same as string but is infite in length, must be last arg
</li>
<li><span class="parameter">string_len</span>
same as string but can define a max lengh
</li>
<li><span class="parameter">number</span>
converts the input into a number
</li>
<li><span class="parameter">number_int</span>
conerts the input to a number and floors it
</li>
<li><span class="parameter">number_range</span>
allows a number in a range after it has been floored min < math.floor(X) <= max
</li>
<li><span class="parameter">number_range</span>
allows a number in a range after it has been floored min < math.floor(X) <= max
</li>
<li><span class="parameter">player</span>
converts the input into a valid player
</li>
<li><span class="parameter">player_online</span>
converts the input to a player if the player is online
</li>
<li><span class="parameter">player_alive</span>
converts the input to a player if the player is online and alive
</li>
<li><span class="parameter">player_rank</span>
-online converts the input to a player if the player is a lower rank than the user and online
</li>
<li><span class="parameter">player_rank</span>
-online converts the input to a player if the player is a lower rank than the user and online
</li>
<li><span class="parameter">player_rank_alive</span>
converts the input to a player if the player is a lower rank than the user and online and alive
</li>
<li><span class="parameter">type</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
the type that the value should be
</li>
<li><span class="parameter">value</span>
the value that will be tested
</li>
<li><span class="parameter">...</span>
any other data that can be passed to the function
</li>
</ul>
<h3>Usage:</h3>
<ul>
<pre class="example">commands.validate[<span class="global">type</span>](value,event,...)</pre>
</ul>
</dd>
</dl>
<h2 class="section-header "><a name="Fields"></a>Fields</h2>
<dl class="function">
<dt>
<a name = "error"></a>
<strong>error</strong>
</dt>
<dd>
Used as an error constant for validation
<h3>Usage:</h3>
<ul>
<li><pre class="example"><span class="keyword">return</span> commands.<span class="global">error</span>, <span class="string">'err message'</span></pre></li>
<li><pre class="example"><span class="keyword">return</span> commands.<span class="global">error</span>(<span class="string">'err message'</span>)</pre></li>
</ul>
</dd>
<dt>
<a name = "data"></a>
<strong>data</strong>
</dt>
<dd>
Index of all command data
<ul>
<li><span class="parameter">key</span>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a>, <a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a> or <span class="type">event</span></span>
the command that will be returned: string is the name, table is the command data, event is event from add_command
</li>
</ul>
<h3>Usage:</h3>
<ul>
<li><pre class="example">commands.command_name <span class="comment">-- returns command data</span></pre></li>
<li><pre class="example">commands.data <span class="comment">-- returns all data</span></pre></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-06-05 19:31:42 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -44,7 +44,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -875,7 +875,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -43,7 +43,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -412,8 +412,20 @@
<h3>Returns:</h3> <h3>Returns:</h3>
<ol> <ol>
<li>
if no thread then it will return the value(s) returned by the callback <span class="types"><span class="type">boolean</span></span>
if no thread then it will return a true for the success</li>
<li>
if no thread then it will return the value(s) returned by the callback</li>
</ol>
<h3>Or</h3>
<ol>
<li>
<span class="types"><span class="type">boolean</span></span>
if no thread then it will return a false for the success</li>
<li>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.4">string</a></span>
if no thread then it will return a an err value</li>
</ol> </ol>
@@ -828,7 +840,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -43,7 +43,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -812,7 +812,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -412,7 +412,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -41,7 +41,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><strong>FSM</strong></li> <li><strong>FSM</strong></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -447,7 +447,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -40,7 +40,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -553,7 +553,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -214,7 +214,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -294,7 +294,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -1123,7 +1123,7 @@ some_func(<span class="number">1</span>,<span class="number">2</span>) <span cla
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -131,7 +131,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -1,131 +0,0 @@
<!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/FSM.html">FSM</a></li>
<li><strong>modules.expgamingcore.commands.control</strong></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.popup.html">modules.expgamingcore.gui.guiparts.popup</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.toolbar.html">modules.expgamingcore.gui.guiparts.toolbar</a></li>
<li><a href="../modules/modules.expgamingcore.gui.control.html">modules.expgamingcore.gui.control</a></li>
<li><a href="../modules/ExpGamingCore.Ranking.html">ExpGamingCore.Ranking</a></li>
<li><a href="../modules/ExpGamingCore.Server.html">ExpGamingCore.Server</a></li>
<li><a href="../modules/ExpGamingCore.Sync.html">ExpGamingCore.Sync</a></li>
<li><a href="../modules/ExpGamingLib.html">ExpGamingLib</a></li>
<li><a href="../modules/StdLib.Color.html">StdLib.Color</a></li>
<li><a href="../modules/StdLib.Game.html">StdLib.Game</a></li>
<li><a href="../modules/StdLib.String.html">StdLib.String</a></li>
<li><a href="../modules/StdLib.Table.html">StdLib.Table</a></li>
<li><a href="../modules/StdLib.Time.html">StdLib.Time</a></li>
</ul>
</div>
<div id="content">
<h1>Module <code>modules.expgamingcore.commands.control</code></h1>
<p>Uses a commands data to return the inputs as a string</p>
<p></p>
<h3>Usage:</h3>
<ul>
<pre class="example">command = command_data[command_name]
command_inputs(command) -- returns &quot;&lt;input1&gt; &lt;input2&gt; &quot;
</pre>
</ul>
<h2><a href="#Functions">Functions</a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap><a href="#commands.get_commands">commands.get_commands (player)</a></td>
<td class="summary">Used to return all the commands a player can use</td>
</tr>
</table>
<br/>
<br/>
<h2 class="section-header "><a name="Functions"></a>Functions</h2>
<dl class="function">
<dt>
<a name = "commands.get_commands"></a>
<strong>commands.get_commands (player)</strong>
</dt>
<dd>
Used to return all the commands a player can use
<h3>Parameters:</h3>
<ul>
<li><span class="parameter">player</span>
the player refreced by string|number|LuaPlayer|event
</li>
</ul>
<h3>Returns:</h3>
<ol>
<span class="types"><a class="type" href="https://www.lua.org/manual/5.2/manual.html#6.5">table</a></span>
a table containg all the commands the player can use
</ol>
<h3>Usage:</h3>
<ul>
<pre class="example">get_commands(<span class="number">1</span>) <span class="comment">-- return {{command data},{command data}}</span></pre>
</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-06-02 21:40:51 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
</html>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -160,7 +160,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><strong>modules.expgamingcore.gui.guiparts.center</strong></li> <li><strong>modules.expgamingcore.gui.guiparts.center</strong></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -278,7 +278,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><strong>modules.expgamingcore.gui.guiparts.inputs</strong></li> <li><strong>modules.expgamingcore.gui.guiparts.inputs</strong></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -434,7 +434,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><strong>modules.expgamingcore.gui.guiparts.left</strong></li> <li><strong>modules.expgamingcore.gui.guiparts.left</strong></li>
@@ -181,7 +181,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -126,7 +126,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -39,7 +39,7 @@
<h2>Modules</h2> <h2>Modules</h2>
<ul class="nowrap"> <ul class="nowrap">
<li><a href="../modules/FSM.html">FSM</a></li> <li><a href="../modules/FSM.html">FSM</a></li>
<li><a href="../modules/modules.expgamingcore.commands.control.html">modules.expgamingcore.commands.control</a></li> <li><a href="../modules/ExpGamingCore.Commands.html">ExpGamingCore.Commands</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.center.html">modules.expgamingcore.gui.guiparts.center</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.inputs.html">modules.expgamingcore.gui.guiparts.inputs</a></li>
<li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li> <li><a href="../modules/modules.expgamingcore.gui.guiparts.left.html">modules.expgamingcore.gui.guiparts.left</a></li>
@@ -117,7 +117,7 @@
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2018-06-02 21:40:51 </i> <i style="float:right;">Last updated 2018-06-05 19:31:42 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>

View File

@@ -1,9 +1,12 @@
[commands] [commands]
unauthorized=401 - Unauthorized: Access is denied due to invalid credentials unauthorized=401 - Unauthorized: Access is denied due to invalid credentials
error-string-len=Invalid Length, Max: __1__
error-number=Invalid Number: Command failed to run
error-number-range=Invalid Range, Min: __1__, Max: __2__
error-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
error-player-online=Player is offline: Command failed to run
error-player-alive=Player is dead: Command failed to run
error-player-rank=Player is of Higher Rank: Command failed to run
invalid-inputs=Invalid Input, /__1__ __2__ invalid-inputs=Invalid Input, /__1__ __2__
invalid-range=Invalid Range, Min: __1__, Max: __2__ invalid-parse=Invalid Input, There was a problem prasing the paramaters
invalid-length=Invalid Length, Max: __1__
invalid-player=Invaild Player Name, __1__ ,try using tab key to auto-complete the name
offline-player=Player is offline: Command failed to run
dead-player=Player is dead: Command failed to run
command-ran=Command Complete command-ran=Command Complete

View File

@@ -0,0 +1,2 @@
[Server]
interface-description=Runs the given input from the script

View File

@@ -1,74 +1,139 @@
--[[ --- A full ranking system for factorio.
Explosive Gaming -- @module ExpGamingCore.Commands
-- @alias commands
-- @author Cooldude2606
-- @license https://github.com/explosivegaming/scenario/blob/master/LICENSE
This file can be used with permission but this and the credit below must remain in the file. --- Used as an error constant for validation
Contact a member of management on our discord to seek permission to use our code. -- @field commands.error
Any changes that you may make to the code are yours but that does not make the script yours. -- @usage return commands.error, 'err message'
Discord: https://discord.gg/r6dC2uK -- @usage return commands.error('err message')
]] commands.error = setmetatable({},{__call=function(...) return ... end})
--Please Only Edit Below This Line----------------------------------------------------------- commands._add_command = commands.add_command
local command_calls = {} local data = {}
local command_data = {}
--- Uses a commands data to return the inputs as a string --- Index of all command data
-- @usage command = command_data[command_name] -- @field commands.data
-- command_inputs(command) -- returns "<input1> <input2> " -- @usage commands.command_name -- returns command data
-- @tparam table the data for the command being run -- @usage commands.data -- returns all data
-- @treturn string the inputs in string format -- @tparam ?string|table|event key the command that will be returned: string is the name, table is the command data, event is event from add_command
local function command_inputs(command) -- @treturn table the command data
if not is_type(command,'table') then return end setmetatable(commands,{
local inputs = '' __index=function(tbl,key) return is_type(key,'table') and (key.command and rawget(data,key.name) or key) or key == 'data' and data or rawget(data,key) end
for _,input in pairs(command.inputs) do })
if input == true then break end
inputs = inputs..'<'..input..'> ' --- Collection of funcations that can be used to validate inputs
-- @table commands.validate
-- @usage commands.validate[type](value,event,...)
-- @tparam string type the type that the value should be
-- @param value the value that will be tested
-- @param ... any other data that can be passed to the function
-- @return[1] the validated value
-- @return[2] error constant
-- @return[2] the err message
-- @field __comment replace _ with - the ldoc did not like me using - in the names
-- @field string basicly does nothing but a type filed is required
-- @field string_inf same as string but is infite in length, must be last arg
-- @field string_len same as string but can define a max lengh
-- @field number converts the input into a number
-- @field number_int conerts the input to a number and floors it
-- @field number_range allows a number in a range min < X <= max
-- @field number_range allows a number in a range after it has been floored min < math.floor(X) <= max
-- @field player converts the input into a valid player
-- @field player_online converts the input to a player if the player is online
-- @field player_alive converts the input to a player if the player is online and alive
-- @field player_rank converts the input to a player if the player is a lower rank than the user
-- @field player_rank-online converts the input to a player if the player is a lower rank than the user and online
-- @field player_rank_alive converts the input to a player if the player is a lower rank than the user and online and alive
commands.validate = {
['string']=function(value,event) return tostring(value) end,
['string-inf']=function(value,event) return tostring(value) end,
['string-len']=function(value,event,max) return tostring(value) and tostring(value):len() <= max and tostring(value) or commands.error{'commands.error-string-len'} end,
['number']=function(value,event) return tonumber(value) or commands.error{'commands.error-number'} end,
['number-int']=function(value,event) return tonumber(value) and math.floor(tonumber(value)) or commands.error{'commands.error-number'} end,
['number-range']=function(value,event,min,max) return tonumber(value) and tonumber(value) > min and tonumber(value) <= max and tonumber(value) or commands.error{'commands.error-number-range'} end,
['number-range-int']=function(value,event,min,max) return tonumber(value) and math.floor(tonumber(value)) > min and math.floor(tonumber(value)) <= max and math.floor(tonumber(value)) or commands.error{'commands.error-number-range'} end,
['player']=function(value,event) return Game.get_player(player) or commands.error{'commands.error-player'} end,
['player-online']=function(value,event) local player,err = commands.validate['player'](value) return err and commands.error(err) or player.conected and player or commands.error{'commands.error-player-online'} end,
['player-alive']=function(value,event) local player,err = commands.validate['player-online'](value) return err and commands.error(err) or player.character and player.character.health > 0 and player or commands.error{'commands.error-player-alive'} end,
['player-rank']=function(value,event) local player,err = commands.validate['player'](value) return err and commands.error(err) or Ranking and Ranking.get_rank(player).power > Ranking.get_rank(event).power or not player.admin or commands.error{'commands.error-player-rank'} end,
['player-rank-online']=function(value,event) local player,err = commands.validate['player-online'](value) return err and commands.error(err) or Ranking and Ranking.get_rank(player).power > Ranking.get_rank(event).power or not player.admin or commands.error{'commands.error-player-rank'} end,
['player-rank-alive']=function(value,event) local player,err = commands.validate['player-alive'](value) return err and commands.error(err) or Ranking and Ranking.get_rank(player).power > Ranking.get_rank(event).power or not player.admin or commands.error{'commands.error-player-rank'} end
}
--- Returns the inputs of this command as a formated string
-- @usage commands.format_inputs('interface') -- returns <code> (if you have ExpGamingCore.Server)
-- @tparam ?string|table|event command the command to get the inputs of
-- @treturn string the formated string for the inputs
function commands.format_inputs(command)
local command = commands[command]
if not is_type(command,'table') then error('Command is not valid',2) end
local rtn = ''
for name,data in pairs(command.inputs) do
if data[1] == false then rtn=rtn..string.format('[%s] ',name)
else rtn=rtn..string.format('<%s> ',name) end
end end
return inputs return rtn
end end
--- Uses the command data and the event to return a table of the args --- Used to validate the arguments of a command, will understand strings with "" as a single param else spaces divede the params
-- @usage command = command_data[command_name] -- @usage commands.validate_args(event) -- returns args table
-- command_args(event,command) -- return {input1='one',input2='two'} -- @tparam table event this is the event created by add_command not on_console_command
-- @tparam defines.events.on_console_command event the event rasied by the command -- @treturn[1] table the args for this command
-- @tparam table command the data for the command being run -- @return[2] command.error
-- @treturn table a table version of the event.parameter based on expected inputs -- @treturn string the error that happend while parsing the args
local function command_args(event,command) function commands.validate_args(event)
if not event or not is_type(command,'table') then return end local command = commands[event.name]
local args = {} if not is_type(command,'table') then error('Command not valid',2) end
-- haddles no parameters given local rtn = {}
local count = 0
local count_opt = 0
for name,data in pairs(command.inputs) do count = count + 1 if data[1] == false then count_opt = count_opt + 1 end end
-- checks that there is some args given if there is ment to be
if not event.parameter then if not event.parameter then
if #command.inputs > 0 then return args, false if count == count_opt then return rtn
else return args, true else return commands.error('invalid-inputs') end
end end
end -- splits the args into words so that it can be used to asign values
-- finds all the words and cheaks if the right number were given
local words = string.split(event.parameter,' ') local words = string.split(event.parameter,' ')
if table.last(command.inputs) == true then local index = 0
if #words < #command.inputs-1 then return args, false end for _,word in pairs(words) do
else index = index+1
if #words < #command.inputs then return args, false end if not word then break end
end local pos, _pos = word:find('"')
-- if it is the right number then process and return the args while pos and pos == _pos do
for index,input in pairs(command.inputs) do local next = table.remove(words,index+1)
if command.inputs[index+1] == true then if not next then return commands.error('invalid-parse') end
args[input] = table.concat(words,' ',index) words[index] = words[index]..' '..next
break _pos = words[index]:find('"',pos+1)
else
args[input] = words[index]
end end
end end
return args, true -- assigns the values from the words to the args
local index = 0
for name,data in pairs(command.inputs) do
index = index+1
local arg = words[index]
if not arg and not data[1] then return commands.error('invalid-inputs') end
if data[2] == 'string-inf' then rtn[name] = table.concat(words,' ',index) break end
local valid = is_type(data[2],'function') and data[2] or commands.validate[data[2]] or error('Invalid type for command: "'..command.name..'/'..name..'"')
local temp_tbl = table.deep_copy(data) table.remove(temp_tbl,1) table.remove(temp_tbl,2)
local value, err = valid(arg,event,unpack(temp_tbl))
if value == commands.error then return value, err end
rtn[name] = value
end
return rtn
end end
--- Used to return all the commands a player can use --- Used to return all the commands a player can use
-- @usage get_commands(1) -- return {{command data},{command data}} -- @usage get_commands(1) -- return table of command data for each command that the player can use
-- @param player the player refreced by string|number|LuaPlayer|event -- @tparam ?index|name|player| player the player to test as
-- @treturn table a table containg all the commands the player can use -- @treturn table a table containg all the commands the player can use
function commands.get_commands(player) function commands.get_commands(player)
local commands = {} local commands = {}
local player = Game.get_player(player) local player = Game.get_player(player)
if not player then return commands end if not player then return error('Invalid player',2) end
local rank = Ranking.get_rank(player) local rank = Ranking.get_rank(player)
for name,data in pairs(command_data) do for name,data in pairs(data) do
if rank:allowed(name) then table.insert(commands,data) end if rank:allowed(name) then table.insert(commands,data) end
end end
return commands return commands
@@ -76,27 +141,27 @@ end
--- Used to call the custom commands --- Used to call the custom commands
-- @usage You dont its an internal command -- @usage You dont its an internal command
-- @tparam defines.events.on_console_command command the event rasied by the command -- @tparam table command the event rasied by the command
local function run_custom_command(command) local function run_custom_command(command)
local command_data = command_data[command.name] local data = commands.data[command.name]
local player_name = Game.get_player(command) and Game.get_player(command).name or 'server' local player_name = Game.get_player(command) and Game.get_player(command).name or 'server'
-- is the player allowed to use this command -- is the player allowed to use this command, if no ExpGamingCore.Ranking then this is ingroned
if is_type(Ranking,'table') and Ranking._presets and Ranking._presets().meta.rank_count > 0 and not Ranking.get_rank(player_name):allowed(command.name) then if Ranking and Ranking.meta and Ranking.meta.rank_count > 0 and not Ranking.get_rank(player_name):allowed(command.name) then
player_return({'commands.unauthorized'},defines.textcolor.crit) player_return({'commands.unauthorized'},defines.textcolor.crit)
if game.player then game.player.play_sound{path='utility/cannot_build'} end if game.player then game.player.play_sound{path='utility/cannot_build'} end
game.write_file('commands.log', game.write_file('commands.log',
game.tick game.tick
..' Player: "'..player_name..'"' ..' Player: "'..player_name..'"'
..' Failed to use command (Unauthorized): "'..command.name..'"' ..' Failed to use command (Unauthorized): "'..command.name..'"'
..' With args of: '..table.tostring(command_args(command,command_data)) ..' With args of: '..table.tostring(commands.validate_args(command))
..'\n' ..'\n'
, true, 0) , true, 0)
return return
end end
-- gets the args for the command -- gets the args for the command
local args, valid = command_args(command,command_data) local args, err = commands.validate_args(command)
if not valid then if args == commands.error then
player_return({'commands.invalid-inputs',command.name,command_inputs(command_data)},defines.textcolor.high) player_return({'commands.'..err,command.name,commands.format_inputs(data)},defines.textcolor.high)
if game.player then game.player.play_sound{path='utility/deconstruct_big'} end if game.player then game.player.play_sound{path='utility/deconstruct_big'} end
game.write_file('commands.log', game.write_file('commands.log',
game.tick game.tick
@@ -108,7 +173,7 @@ local function run_custom_command(command)
return return
end end
-- runs the command -- runs the command
local success, err = pcall(command_calls[command.name],command,args) local success, err = pcall(data.callback,command,args)
if not success then error(err) end if not success then error(err) end
if err ~= commands.error and player_name ~= 'server' then player_return({'commands.command-ran'},defines.textcolor.info) end if err ~= commands.error and player_name ~= 'server' then player_return({'commands.command-ran'},defines.textcolor.info) end
game.write_file('commands.log', game.write_file('commands.log',
@@ -120,32 +185,54 @@ local function run_custom_command(command)
, true, 0) , true, 0)
end end
-- this is a set of constants you can use
commands._add_command = commands.add_command --if you dont want to use the custom commands interface
commands.expgaming = true --if you want to test if the custom commands are present
commands.error = {} --if returned during a custom command, Command Complete message not printed
--- Used to define commands --- Used to define commands
-- @usage inputs = {'player','reason',true} -- @usage --see examples in file
-- commands.add_command('ban','bans a player',inputs,function() return end)
-- @tparam string name the name of the command -- @tparam string name the name of the command
-- @tparam[opt='No Description'] string description the description of the command -- @tparam[opt='No Description'] string description the description of the command
-- @tparam[opt={'parameter',true}] table inputs a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word) -- @tparam[opt=an infite string] table inputs a table of the inputs to be used, last index being true makes the last parameter open ended (longer than one word)
-- @tparam function event the function to call on the event -- @tparam function callback the function to call on the event
commands.add_command = function(name, description, inputs, event) commands.add_command = function(name, description, inputs, callback)
if command_calls[name] then return end if commands[name] then error('That command is already registered',2) end
if not is_type(name,'string') then return end if not is_type(name,'string') then error('Command name has not been given') end
if not is_type(event,'function') then return end if not is_type(callback,'function') or not is_type(inputs,'table') then
if is_type(inputs,'function') then commands._add_command(name,description,inputs)
else error('Invalid args given to add_command') end
end
verbose('Created Command: '..name) verbose('Created Command: '..name)
local description = is_type(description,'string') and description or 'No Description' -- test for string and then test for locale string
local inputs = is_type(inputs,'table') and inputs or {'parameter',true} local description = is_type(description,'string') and description
command_data[name] = { or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,''}
or 'No Description'
local inputs = is_type(inputs,'table') and inputs or {['param']={false,'string-inf'}}
data[name] = {
name=name, name=name,
description=description, description=description,
inputs=inputs inputs=inputs,
callback=callback
} }
command_calls[name] = event local help = is_type(description,'string') and commands.format_inputs(name)..'- '..description
commands._add_command(name,command_inputs(command_data[name])..'- '..description,function(...) or is_type(description,'table') and is_type(description[1],'string') and string.find(description[1],'.+[.].+') and {description,commands.format_inputs(name)..'- '}
or commands.format_inputs(name)
data[name].help = help
commands._add_command(name,help,function(...)
local success, err = pcall(run_custom_command,...) local success, err = pcall(run_custom_command,...)
if not success then error(err) end if not success then error(err) end
end) end)
end end
--[[
command example
locale file
[foo]
description=__1__ this is a command
commands.add_command('foo',{'foo.description'},{
['player']={true,'player'}, -- a required arg that must be a valid player
['number']={true,'number-range',0,10}, -- a required arg that must be a number 0<X<=10
['reason']={false,'string-inf'} -- an optinal arg that is and infite lengh (useful for reasons)
},function(event,args)
args.player.print(args.number)
if args.reasons then args.player.print(args.reason) end
end)
]]

View File

@@ -84,8 +84,10 @@ Ranking.groups = setmetatable({},{
Ranking.meta = setmetatable({},{ Ranking.meta = setmetatable({},{
__metatable=false, __metatable=false,
__call=function(tbl) __call=function(tbl)
local count = 0
rawset(tbl,'time_ranks',{}) rawset(tbl,'time_ranks',{})
for name,rank in pairs(Ranking.ranks) do for name,rank in pairs(Ranking.ranks) do
count=count+1
if not rawget(tbl,'default') and rank.is_default then rawset(tbl,'default',rank.name) end if not rawget(tbl,'default') and rank.is_default then rawset(tbl,'default',rank.name) end
if not rawget(tbl,'root') and rank.is_root then rawset(tbl,'root',rank.name) end if not rawget(tbl,'root') and rank.is_root then rawset(tbl,'root',rank.name) end
if rank.time then if rank.time then
@@ -94,6 +96,7 @@ Ranking.meta = setmetatable({},{
if not rawget(tbl,'time_lowest') or rank.time < tbl.time_lowest then rawset(tbl,'time_lowest',rank.time) end if not rawget(tbl,'time_lowest') or rank.time < tbl.time_lowest then rawset(tbl,'time_lowest',rank.time) end
end end
end end
rawset(tbl,'rank_count',count)
if not rawget(tbl,'default') then error('No default rank') end if not rawget(tbl,'default') then error('No default rank') end
if not rawget(tbl,'root') then error('No root rank') end if not rawget(tbl,'root') then error('No root rank') end
end, end,
@@ -444,6 +447,7 @@ Ranking.on_init=function(self)
end end
end end
-- asigning of powers -- asigning of powers
-- @todo need a better system for non liner rank trees
verbose('Assigning Rank Powers') verbose('Assigning Rank Powers')
local power = 1 local power = 1
local function set_powers(rank) local function set_powers(rank)

View File

@@ -193,7 +193,10 @@ end
-- @tparam[opt] ?Server._thread|true use_thread run the command on a premade thread or let it make its own -- @tparam[opt] ?Server._thread|true use_thread run the command on a premade thread or let it make its own
-- @tparam[opt] table env run the env to run the command in must have _env key as true to be -- @tparam[opt] table env run the env to run the command in must have _env key as true to be
-- @param[opt] ... any args you want to pass to the function -- @param[opt] ... any args you want to pass to the function
-- @return if no thread then it will return the value(s) returned by the callback -- @treturn[1] boolean if no thread then it will return a true for the success
-- @return[1] if no thread then it will return the value(s) returned by the callback
-- @treturn[2] boolean if no thread then it will return a false for the success
-- @treturn[2] string if no thread then it will return a an err value
function Server.interface(callback,use_thread,env,...) function Server.interface(callback,use_thread,env,...)
if use_thread then if use_thread then
-- if use_thread is true then it makes a new thread -- if use_thread is true then it makes a new thread
@@ -217,15 +220,20 @@ function Server.interface(callback,use_thread,env,...)
use_thread:open() use_thread:open()
Server.queue_thread(use_thread) Server.queue_thread(use_thread)
else else
local callback = is_type(callback,'function') and callback or loadstring(callback) local _callback = callback
if not is_type(callback,'function') then
local rtn, err = loadstring(callback)
if err then return false, err end
_callback = rtn
end
if is_type(env,'table') and env._env == true then if is_type(env,'table') and env._env == true then
local sandbox, success, err = Manager.sandbox(callback,env,unpack(thread.data)) local sandbox, success, err = Manager.sandbox(_callback,env,...)
if not success then error(err) end if not success then error(err) return success,err
return err else return success, unpack(err) end
else else
local sandbox, success, err = Manager.sandbox(callback,{},env,unpack(thread.data)) local sandbox, success, err = Manager.sandbox(_callback,{},env,...)
if not success then error(err) end if not success then error(err) return success,err
return err else return success, unpack(err) end
end end
end end
end end

View File

@@ -10,7 +10,9 @@
--- Runs the given input from the script --- Runs the given input from the script
-- @command interface -- @command interface
-- @param code The code that will be ran -- @param code The code that will be ran
commands.add_command('interface', 'Runs the given input from the script', {'code',true}, function(event,args) commands.add_command('interface',{'Server.interface-description'}, {
['code']={true,'string-inf'}
}, function(event,args)
local callback = args.code local callback = args.code
-- looks for spaces, if non the it will prefix the command with return -- looks for spaces, if non the it will prefix the command with return
if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end if not string.find(callback,'%s') and not string.find(callback,'return') then callback = 'return '..callback end
@@ -28,7 +30,7 @@ commands.add_command('interface', 'Runs the given input from the script', {'code
-- runs the function -- runs the function
local success, err = Server.interface(callback,false,env) local success, err = Server.interface(callback,false,env)
-- if there is an error then it will remove the stacktrace and return the error -- if there is an error then it will remove the stacktrace and return the error
if not success and is_type(err,'string') then local _end = string.find(err,'stack traceback') if _end then err = string.sub(err,0,_end-2) end end if not success and is_type(err,'string') then local _end = string.find(err,':1:') if _end then err = string.sub(err,_end+4) end end
-- if there is a value returned that is not nill then it will return that value -- if there is a value returned that is not nill then it will return that value
if err or err == false then player_return(err) end if err or err == false then player_return(err) end
end) end)

View File

@@ -102,6 +102,7 @@ end
-- @see EmitEmbededParamaters -- @see EmitEmbededParamaters
function Sync.emit_embeded(args) function Sync.emit_embeded(args)
if not is_type(args,'table') then error('Args table not given to Sync.emit_embeded',2) end if not is_type(args,'table') then error('Args table not given to Sync.emit_embeded',2) end
if not game then error('Game has not loaded',2) end
local title = is_type(args.title,'string') and args.title or '' local title = is_type(args.title,'string') and args.title or ''
local color = is_type(args.color,'string') and args.color:find("0x") and args.color or '0x0' local color = is_type(args.color,'string') and args.color:find("0x") and args.color or '0x0'
local description = is_type(args.description,'string') and args.description or '' local description = is_type(args.description,'string') and args.description or ''

View File

@@ -14,8 +14,11 @@
"version": "3.4.0", "version": "3.4.0",
"location": "url", "location": "url",
"dependencies": { "dependencies": {
"ExpGamingLib": ">=4.0.0", "ExpGamingLib": "^4.0.0",
"ExpGamingCore/Ranking": ">=4.0.0" "FactorioStdLib.Table": "^0.8.0",
"FactorioStdLib.Color": "^0.8.0",
"FactorioStdLib.Game": "^0.8.0",
"ExpGamingCore/Ranking": "?^4.0.0"
} }
}, },
"Gui": { "Gui": {
@@ -26,10 +29,10 @@
"version": "3.4.0", "version": "3.4.0",
"location": "url", "location": "url",
"dependencies": { "dependencies": {
"FactorioModGui": ">=1.0.0", "FactorioModGui": "^1.0.0",
"ExpGamingLib": ">=4.0.0", "ExpGamingLib": "^4.0.0",
"ExpGamingCore/Ranking": ">=4.0.0", "ExpGamingCore/Ranking": "^4.0.0",
"ExpGamingCore/Server": "?>=4.0.0" "ExpGamingCore/Server": "?^4.0.0"
} }
}, },
"Ranking": { "Ranking": {
@@ -40,10 +43,11 @@
"version": "3.4.0", "version": "3.4.0",
"location": "url", "location": "url",
"dependencies": { "dependencies": {
"ExpGamingLib": ">=4.0.0", "ExpGamingLib": "^4.0.0",
"FactorioStdLib.Color": ">=0.8.0", "FactorioStdLib.Color": "^0.8.0",
"FactorioStdLib.Table": ">=0.8.0", "FactorioStdLib.Table": "^0.8.0",
"ExpGamingCore.Server": "?>=4.0.0" "FactorioStdLib.Game": "^0.8.0",
"ExpGamingCore.Server": "?^4.0.0"
} }
}, },
"Server": { "Server": {
@@ -54,10 +58,11 @@
"version": "3.4.0", "version": "3.4.0",
"location": "url", "location": "url",
"dependencies": { "dependencies": {
"ExpGamingLib": ">=4.0.0", "ExpGamingLib": "^4.0.0",
"FactorioStdLib.Table": ">=0.8.0", "FactorioStdLib.Table": "^0.8.0",
"ExpGamingCore.Ranking": "?>=4.0.0", "FactorioStdLib.Game": "^0.8.0",
"ExpGamingCore.Commands": "?>=4.0.0" "ExpGamingCore.Ranking": "?^4.0.0",
"ExpGamingCore.Commands": "?^4.0.0"
} }
}, },
"Sync": { "Sync": {
@@ -68,11 +73,11 @@
"version": "3.4.0", "version": "3.4.0",
"location": "url", "location": "url",
"dependencies": { "dependencies": {
"ExpGamingLib": ">=4.0.0", "ExpGamingLib": "^4.0.0",
"FactorioStdLib.Color": ">=0.8.0", "FactorioStdLib.Color": "^0.8.0",
"FactorioStdLib.Table": ">=0.8.0", "FactorioStdLib.Table": "^0.8.0",
"ExpGamingCore.Ranking": "?>=4.0.0", "ExpGamingCore.Ranking": "?^4.0.0",
"ExpGamingCore.Gui": "?>=4.0.0" "ExpGamingCore.Gui": "?^4.0.0"
} }
} }
}, },

View File

@@ -20,6 +20,7 @@ end
--- Used to get the current ENV with all _G keys removed; useful when saving function to global --- Used to get the current ENV with all _G keys removed; useful when saving function to global
-- @usage get_env() returns current ENV with _G keys removed -- @usage get_env() returns current ENV with _G keys removed
-- @treturn table the env table with _G keys removed -- @treturn table the env table with _G keys removed
-- @warning does not work from console
function ExpLib.get_env() function ExpLib.get_env()
local level = 2 local level = 2
local env = setmetatable({},{__index=_G}) local env = setmetatable({},{__index=_G})

View File

@@ -6,9 +6,9 @@
"version": "3.4.0", "version": "3.4.0",
"location": "url", "location": "url",
"dependencies": { "dependencies": {
"StdLib.Game": ">=0.8.0", "StdLib.Game": "^0.8.0",
"StdLib.Color": ">=0.8.0", "StdLib.Color": "^0.8.0",
"StdLib.Table": ">=0.8.0" "StdLib.Table": "^0.8.0"
}, },
"author": "Cooldude2606", "author": "Cooldude2606",
"contact": "Discord: Cooldude2606#5241", "contact": "Discord: Cooldude2606#5241",

View File

@@ -10,7 +10,7 @@ return {
['table']='/modules/FactorioStdLib/Table', ['table']='/modules/FactorioStdLib/Table',
['string']='/modules/FactorioStdLib/String', ['string']='/modules/FactorioStdLib/String',
['Ranking']='/modules/ExpGamingCore/Ranking', ['Ranking']='/modules/ExpGamingCore/Ranking',
--['commands']='/modules/ExpGamingCore/Commands', ['commands']='/modules/ExpGamingCore/Commands',
--['Gui']='/modules/ExpGamingCore/Gui', --['Gui']='/modules/ExpGamingCore/Gui',
['Server']='/modules/ExpGamingCore/Server', ['Server']='/modules/ExpGamingCore/Server',
['Sync']='/modules/ExpGamingCore/Sync', ['Sync']='/modules/ExpGamingCore/Sync',