Lua Server Pages, a Lua scripting engine plug-in that blows away any other approach to embedded web development, offers a dramatic short cut to traditional C server pages. The Lua Server Pages plug-in (included in the Barracuda Application Server) makes developing applications extremely fast, simple, and safe. Notably, it isn’t limited to developing web applications, but can also be used to provide high-level socket APIs that make developing secure socket applications very easy. We also provide HTTP client libraries, SMTP (mail) libraries, etc. In fact, we estimate that up to 80% of a modern embedded system could be implemented using Lua Server Pages, ensuring dramatically reduced development time.
How LUA Works
Lua is a scripting language and includes a compiler that compiles the scripts on the fly to a register-based instruction set. The instruction set is then executed by the virtual machine. The Lua compiler and the virtual machine are implemented in C code and can run in virtually any device with sufficient memory. The Barracuda Application Server, the Lua Server Pages plug-in, and all plug-ins required by the Lua Server Pages use roughly 600 kbytes of ROM. We recommend a minimum of 500 kbytes RAM for running your scripts.
LUA Server Pages Advantages
Lua is not your average scripting language. Lua is small, fast, portable, and embeddable. These cornerstones of the language make it well-suited for embedded devices, web applications, and protocol stacks.
- Lua Server Pages are designed to be embedded.
- Lua Server Pages use one of the fastest scripting languages available.
- Lua Server Pages are small.
- Lua Server Pages are easy to learn.
- Lua Server Pages are designed to help you cut development cost and time to market.
LUA Server Pages Development Process
The development cycle is a straight-forward, three-step process. Recompiling a modified Lua Server Page and executing the Lua Server Page is as simple as refreshing the browser window. When the browser sends the request, the server loads, compiles, and executes the new script. The figure to the right illustrates this process.
The Lua plug-in comprises the Lua engine and interface logic to the Barracuda Application Server’s C API. The interface logic is referred to as a “Lua binding” and makes it possible for Lua scripts to call C functions. We provide bindings to most of the C APIs in the Barracuda Application Server, including plug-ins such as the WebDAV Server.
The Lua Server Pages plug-in is designed to be extended and lets you add your own device management APIs. We also provide an online C parser that automatically generates Lua bindings for your C device management APIs.
Lua Server Pages require that you provide some start-up code in C, but no C code is required when assembling web-server components. All components, including opening server listen ports, managing SSL certificates and so on, can be dynamically managed from within a Lua script. Lua also makes it possible to dynamically add and remove server components in a running system. For example, you can dynamically change the listen port numbers without restarting the server.
About Real Time Logic
Real Time Logic is a world class IoT security and web-enablement specialist. Their solutions and Ecosystem Partners drive modern real-time embedded applications to ensure the smooth deployment and safe operation of next generation products. More details…
Find out more
For more information on fast embedded web development with the LUA server plugin for the Barracuda web server please complete the form below.