Lua References and Best Practices¶
Intelligent Modules in Composer utilize scripts to control their functionality and to communicate with devices. These scripts are written in Lua, a powerful, efficient, lightweight scripting language. It is used in other similar applications because of its ability to allow users to write scripts that interact with software running on both computers and embedded devices like Symetrix DSPs.
It is beyond the scope of the Symetrix documentation, to teach the entirety of Lua. Instead, this document will point to the abundance of freely available reference material already available.
Reference Manual¶
All creators of Intelligent Modules should visit and bookmark the following Lua Reference Manual.
http://www.lua.org/manual/5.3/
This is the complete reference to the language and all standard library functions. Note the Composer 8.0 uses Lua 5.3. At the time of this writing, Lua 5.4 was just released. Symetrix may consider incorporating this update at a future time.
Programming In Lua¶
For those who want a more instructional step by step walkthrough from which to learn Lua, we highly recommend the official “Programming In Lua” book. This is available in both physical book and eBook formats.
Composer Removed Features¶
Note there are some Lua standard library features that have been disabled in Composer, to protect you and the system. These include the following.
-
LuaSockets - LuaSockets is a public Lua library implementing sockets. It is considered a security risk to have it available on the DSP unit’s file system and so is not included. Much of this functionality is available via the TCP and UDP API Extensions.
-
SSL - SSL is not supported.
-
IO - The io library is not supported for security and reliability reasons.
-
OS - The os library is only partially for security and reliability reasons. The functions “execute”, “exit”, “remove”, “rename”, “setlocale” and “tmpname” are prevented from operating.
-
DEBUG - The debug library is currently supported to allow for execution time monitoring. It is recommended that it not be used in user created scripts.