Features

Lua programming language

Lua is a powerful, lightweight scripting language embedded in eScada. Within the eScada programming hierarchy it represents the highest level context, sitting on top of Expressions, Derived Objects and Macros: while those efficiently handle data pre-elaboration, functional blocks and sequential commands, Lua provides a full modern scripting environment for complicated logic, advanced algorithms and sophisticated system behaviours.

Lua modules can be used in two ways: as "LuaModule" derived objects, ideal for small pieces of code executed by triggers, or as external .lua files stored in the project's own "lua" folder. A dedicated Lua context in the development suite offers the tools to manage large modules comfortably, and modules can optionally receive parameters, so the same script can behave differently across devices and configurations.

The entire Lua code can interact with eScada objects through dedicated contexts:

  • esProject: project information and system commands: read and write whole groups, save and load tag values, take snapshots of the running project
  • esSystem: file system utilities: user and temporary paths, file and folder checks, ZIP archive creation
  • esUtility: general purpose helpers: bitwise operations, Base64 encoding, UUID generation, CRC-16 and CRC-32 checksums
  • esEncryption: SHA-2 hashing, key derivation from passphrases and AES-256 encryption and decryption
  • esString: string manipulation with full UTF-8 support, plus runtime translation using the project languages
  • esTags: full access to project tags: read and write values, batch updates, scaling limits, metadata, polling and offline status
  • esNotification: activate, acknowledge and reset notifications, and update their messages dynamically

An advanced use of Lua permits to integrate other external libraries written using C, C++ and C# languages.

The complete guide, with syntax, recommendations and examples for every function, is available in the eScada.Development.Lua document.

← Back to all features