Scripting Guide

Introduction

A Quick Example of Scripting in AutoPlay Media Studio

Important Scripting Concepts

Script is Global

Script is Case-Sensitive

Comments

Delimiting Statements

Variables

What are Variables?

Variable Scope

Local Variables

Variable Naming

Reserved Keywords

Types and Values

Number

String

Nil

Boolean

Function

Table

Variable Assignment

Expressions and Operators

Arithmetic Operators

Relational Operators

Logical Operators

Concatenation

Operator Precedence

Control Structures

If

While

Repeat

For

Tables (Arrays)

Creating Tables

Accessing Table Elements

Numeric Arrays

Associative Arrays

Using For to Enumerate Tables

Copying Tables

Table Functions

Functions

Function Arguments

Returning Values

Returning Multiple Values

Redefining Functions

Putting Functions in Tables

String Manipulation

Concatenating Strings

Comparing Strings

Counting Characters

Finding Strings

Replacing Strings

Extracting Strings

Converting Numeric Strings into Numbers

Other Built-in Functions

Script Functions

dofile

require

type

Actions

Debugging Your Scripts

Error Handling

Syntax Errors

Functional Errors

Debug Actions

Application.GetLastError

Debug.ShowWindow

Debug.Print

Debug.SetTraceMode

Debug.GetEventContext

Dialog.Message

Final Thoughts

Other Resources

Help File

Userís Guide

AutoPlay Media Studio Web Site

Indigo Rose Technical Support

The Lua Web Site