Embedded Lua Scripting

lua

The Arterial XML eBusiness Server (aXes) includes an implementation of the scripting language Lua, with specific extensions for IBM OS/400. Version 1.20 of aXes is based on version 4.0 of Lua. The Lua web-site is located at http://www.lua.org.

Lua is a powerful, light-weight programming language designed for extending applications. Lua is also frequently used as a general-purpose, stand-alone language. Lua combines simple procedural syntax with powerful data description constructs based on associative arrays and extensible semantics. Lua is dynamically typed, interpreted from opcodes, and has automatic memory management with garbage collection, making it ideal for configuration, scripting, and rapid prototyping. Obvious benefits of Lua are speed, simplicity and size.

Why use OS/400 Lua?

Lua has many general advantages:

  • It is simple but powerful.
  • It is easy to use.
  • It is portable, so that programs written in pure Lua will run on a large number of platforms.
  • Its programs can be split up over separate files for greater modularity.
  • It comes with its own compiler and the compiled code is also portable.
  • Available natively on the iSeries

The features that give Lua its power are:

  • Functions are another data type. You can assign them to variables like any other value.
  • The basic data type is a table which combines the notion of array with that of a record. Indices can be any kind of non-nil value.
  • It has the powerful pattern-matching functions which characterize scripting languages.
  • Functions can return many values at once.
  • It has lexical scoping. Variables can be declared local inside any block.
  • OS/400 specific extensions.

aXes Lua Extensions

aXes implements a number of generic and OS/400 specific functions in Lua. These functions are provided in addition to those supplied and documented with the standard Lua Distribution. You can get the documentation from the Lua web site which is located here http://www.lua.org/manual/.

aXes Lua extensions include:

  • Program call functions
  • Data queue functions
  • HTML functions
  • FastCGI functions
  • SQL functions
  • Miscellaneous utility functions