executionContexts

Reports information on the current state of the running application.

# Metadata

Platforms: desktop, server, mobile OS: mac, windows, linux, ios, android Introduced: 1.1 Security:

# Syntax

get the executionContexts

# Examples

on errorDialog local tContextArray local tHandler, tLineNumber, tObject put parsedContext(line -2 of the executionContexts) into tContextArray if tContextArray["behavior"] is empty then put tContextArray["object"] into tObject else put tContextArray["behavior"] into tObject end if put tContextArray["handler"] into tHandler put tContextArray["line"] into tLineNumber answer "An error occurred at line" && tLineNumber && "in handler" && tHandler && "of" && tObject end errorDialog function parsedContext pContextLine local tKey = "object", tContextA repeat for each item tItem in pContextLine if tContextA[tKey] is not empty then put comma after tContextA[tKey] end if put tItem after tContextA[tKey] switch tKey case "object" if exists(tContextA[tKey]) then put "handler" into tKey end if break case "handler" put "line" into tKey break case "line" put "behavior" into tKey break end switch end repeat end parsedContext

# Description

Use the executionContexts property to obtain information about the state of your program, particularly when debugging and error handling.

The last line of the executionContexts represents the current context, i.e. the line of code last executed.

A common use of the executionContexts is to obtain the name of the object and handler that called the current handler, this information is available as: line -2 of the executionContexts.

>**Note:** if the function call occurred in a behavior script, then the line number refers to the behavior script, not the target script.

The executionContexts property is read-only and cannot be set.

> *Important:* The value of the executionContexts may be changed in future > versions of LiveCode, it is not recommended to write code that depends on > its contents.

# Tags

# See

- **message:** errorDialog