Working with Scripts


The Mira Pro Script module extends Mira's capabilities for image processing and general computational applications by adding classes and functions to the Lua language (see https://lua.org). This provides a complete program extension facility that utilizes Mira's image and data processing capabilities as well as general computing tasks that do not involve Mira tools. Scripts are not required to use Mira's built-in image processing capabilities. For example, a script might be used to automate a complex image processing procedure, evaluate prototypes for different processing algorithms, create a 2-D mathematical simulation or model, or do something completely different, like update a semester course calendar based on the date of first class meeting.

Complete documentation on script functions, classes, methods, and other features is found in theMira Pro x64 Script User's Guide which can be viewed in several ways:

Overview

A Lua script file is simply a text file with the .lua file type extension that Mira interprets as containing a Lua script. For viewing, creating, and modifying scripts, Mira provides the Script Editor Window, which is a syntax highlighting text editor that provides color and other markup to highlight various elements of the script. This effect can be viewed by comparing the same script file in the Mira Script Editor Window with a plain text editor like Notepad. Scripts can be created and edited outside Mira using Notepad or another editor, but must be run (or executed) from inside Mira. External editors that support syntax highlighting for the Lua language include Notepad++ and SciTE, both of which are currently available at no cost.

Scripts are run (or executed) using the [!] button on the toolbar at the top of the Script Editor Window and Main Toolbar, and from the Script Manager. Mira feeds the script text to the Lua engine, which then compiles the text to byte code and executes it. Running compiled code has benefits over interpreted scripts, including execution speed and detection of syntax errors before execution begins.

Opening a Script

To open a script from a file, do one of the following. These actions load the existing script into a Script Editor:

Running a Script

There are several ways to run a script. Use the method that is appropriate:

Saving a Script

Scripts are saved to text files with a lua file extension. You can choose to save scripts in the ...\Mira Pro 8 x64\Scripts folder tree or anywhere in your file system. If you choose To save them outside the ...\Mira Pro 8 x64\Scripts folder tree, then they will not be accessible from the Script Manager. To save a script, use one of the following methods:

Creating a New Script

To create a new script, do one of the following. These actions open an empty Script Editor:

Related Topics

Contents

Script Editor

Script Manager

Edit Script Keywords


Mira Pro x64 User's Guide, Copyright Ⓒ 2023 Mirametrics, Inc. All Rights Reserved.