Variables

Global variables are variables whose values are automatically set when the LuaScript DLL starts. They are used in action script to represent common values that might differ between systems. These variables are all global which means you can use them anywhere in your script.

Tip: Often global variables are used as part of a full path where you need to join two strings together. For example, you may need a path consisting of the user's Temporary folder and a folder such as "ApplicationX." To do this, you would use the string concatenation operator which consists of two dots (..). The script looks like this:

_TempFolder .. "\\ApplicationX"


You can also use the String.Concat action to concatenate two strings.

Note: There are also a series of actions available that can be used to gather information about the user's system that may not be part of the built-in variables list. For example, additional common folder paths can be read using the Shell.GetFolder action. There is also a System category of actions for other system information.

For more information on variables, see Variables in the Scripting Guide.

The following global variables are available in LuaScript:

_hInstall

The handle to the installer that is passed to the LuaScript DLL.

_IR_ProductID

This variable contains the string "LUASCRIPT10" when used in the LuaScript DLL. This allows you to identify the product being run from script.  This could be useful when making generic scripts that are used in several products, but that have different things to do based on the product being run from.

_SourceDrive

The drive that the LuaScript DLL was run from (e.g. "C:" or "D:").

_SystemFolder

The path to the user’s Windows System folder (e.g. "C:\Windows\System" on non-NT systems and "C:\Windows\System32" on NT based systems).

_tblErrorMessages

A table indexed by error codes containing all of the possible error messages. For example, accessing the table index _tblErrorMessages[1000] will access the error code string "The specified file could not be found." The Application.GetLastError action is used to retrieve the last performed action's error code.

_TempFolder

The path to the user's Temp folder.

_WindowsFolder

The path to the user's Windows folder (e.g. "C:\Windows").