script

Typeproperty
DictionaryLCS
LibraryLiveCode Script
Syntax
set the script of <object> to <string>
Associationsstack, card, field, button, graphic, scrollbar, player, image
Summary

Specifies the contents of an object's script.

Introduced1.0
OSmac, windows, linux, ios, android
Platformsdesktop, server, mobile
Example
set the script of button 2 to empty -- clear out the script
set the script of field "Get It" to field "Get It Script"
Values
NameTypeDescription
Value

The script of an object is a string consisting of handlers and comments. By default, the script of a newly created object is empty.

RelatedCommand: remove script, edit
Glossary: object
Property: script
Description

Use the script property to examine or change an object's script from inside a LiveCode statement, instead of using the script editor.

An object's script is the code that controls that object. All of an object's handlers are part of its script property.

You can view and change a script directly by selecting the object and choosing Object menu. Use the script property within a handler to check the contents of a script, or change the script.

LiveCode compiles the script immediately after it is set. This means that it is not possible to write a self-modifying handler, because the currently-executing handler would have to be changed and re-compiled while it was running.