scriptOnly

Typeproperty
DictionaryLCS
LibraryLiveCode Script
Syntax
set the scriptOnly of <stack> to { true | false }
Associationsstack
Summary

Specifies whether the stack should be saved as script only which does not retain any objects or custom properties

Introduced8.0
OSmac, windows, linux, ios, android
Platformsdesktop, mobile, server
Parameters
NameTypeDescription
Stack

The name or ID of the stack.

Example
-- git blame on a script only stack
if the scriptOnly \
      of stack theStack and the filename of stack theStack is not empty then
  put the folder into theOldFolder
  set the itemDelimiter to slash
  set the folder to item 1 to -2 of the filename of stack theStack
  put shell("git blame" && the last item \
        of the filename of stack theStack) into field "blame"
  set the folder to theOldFolder
end if
-- password protect for deployment
if the scriptOnly of stack theStack then
  set the scriptOnly of stack theStack to false
  set the password of stack theStack to uuid()
  put the filename of stack theStack into theFilename
  set the itemDelimiter to "."
  put "livecode" into the last item of theFilename
  set the filename of stack theStack to theFilename
  save stack theStack
  set the password of stack theStack to empty
  set the scriptOnly of stack theStack to true
  put "livecodescript" into the last item of theFilename
end if
RelatedProperty: behavior
Command: create stack
Object: stack
Glossary: script only stack
Description

A script only stack is a stack whose scriptOnly property is true. A scriptOnly stack will save just the script with a single header line declaring the stack name. If the stack has a stack behavior, the name of the behavior stack is also saved to the header line. Any other objects or properties of the stack will not be written to disk.

The scriptOnly property has been added to enable scripts to detect and set the file format of the stack. Without this property it is not possible to detect the file format the stack is being saved in without examining the file itself.

Warning: scriptOnly stacks only save the stack name, script and stack behavior. Any other type of behavior, or property changes and objects created while the stack is open will not exist the next time the stack is opened.

Note: Script only stacks are unable to be password protected. In order to password protect a script only stack use the following commands.

set the scriptOnly of stack "Secrets" to false
set the password of stack "Secrets" to field "Password"

Tagsobjects