Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The integrated LUA script engine also provides the opportunity to split the LUA implementation into separate source files. Using this way, it is possible to implement user-defined LUA functions that can be reused in other NETx BMS Core Server projects. In addition it keeps the LUA source code short, clearly arranged, and easy to maintain.


User-defined LUA script files have to be stored within the script directory of the workspace directory. To reuse a LUA script file, it has to be imported within the standard LUA file "nxaDefinitions.lua" by using the key work "require".
Example:

require "MyLuaScriptFile"


This code line includes the file "MyLuaScriptFile.lua" into the default LUA script file – thus all functions that are defined there are available within the whole script engine. Note that is has to be ensured that a function name is used only once.
In order to load a previously encrypted LUA script us the nxa.LoadXLuaLibrary function:
<file name="nxa.LoadXLuaLibrary">
<h1>Description - INTERNAL DOCUMENTATION</h1>
<h1>Signature</h1> nxa.LoadXLuaLibrary (filename) <p>This function loads a LUA script that was previously encrypted using the NETx LUA Protector and makes its containing functions available.</p>
<h1>Parameters</h1>
<table>
<colgroup> <col/> <col/> <col/> <col/> </colgroup>
<tbody>
<tr>
<th>Name</th>
<th>Type</th>
<th>Mandatory/Optional</th>
<th>Description</th>
</tr>
<tr><td></td><td>filename</td><td>M</td><td>the filename with extension that will be looked for in the workspace's ScriptFiles directory</td></tr>
</tbody>
</table>
<h1>Return</h1> None.
</file>