BaseScript
The base class for all script objects which run automatically.
| Memory category | Script |
|---|
Member index 4
Description
The base class for all script objects which run automatically.
History 25
- 731 Change Default of RunContext from to
- 731 Change Default of LinkedSource from to
- 731 Change Default of Enabled from to
- 731 Change Default of Disabled from to
- 726 Change Default of RunContext from to
- 726 Change Default of LinkedSource from to
- 726 Change Default of Enabled from to
- 726 Change Default of Disabled from to
- 645 Change ValueType of LinkedSource from Content to ContentId
- 614 Change Tags of LinkedSource from [] to [Deprecated]
- 566 Change ReadSecurity of RunContext from PluginSecurity to None
- 553 Change Default of RunContext from to
- 553 Change Default of LinkedSource from to
- 553 Change Default of Enabled from to
- 553 Change Default of Disabled from to
- 542 Add Enabled
- 534 Add RunContext
- 486 Change ThreadSafety of LinkedSource from ReadOnly to ReadSafe
- 486 Change ThreadSafety of Disabled from ReadOnly to ReadSafe
- 462 Change ThreadSafety of LinkedSource from to ReadOnly
- 462 Change ThreadSafety of Disabled from to ReadOnly
- 187 Change Superclass of BaseScript from Instance to LuaSourceContainer
- 47 Add LinkedSource
- 47 Add Disabled
- 47 Add BaseScript
Members 4
Disabled
| Type | Default | |
|---|---|---|
| bool | ||
Determines whether a BaseScript runs or not.
Setting this property to true while the script is running drops its references to the script's thread; a thread that is yielded (or that yields later) is never resumed and becomes eligible for garbage collection. A thread that is actively executing continues to run until it next yields or returns.
If this property is changed from true to false, a fresh run of the script is started. This means that Disabled can be toggled to restart a script.
| Thread safety | ReadSafe |
|---|---|
| Category | Behavior |
| Loaded/Saved | true |
Enabled
| Type | Default | |
|---|---|---|
| bool | ||
Determines whether a BaseScript runs or not. We recommend this property over the similar but opposite Disabled.
Setting this property to false while the script is running drops its references to the script's thread; a thread that is yielded (or that yields later) is never resumed and becomes eligible for garbage collection. A thread that is actively executing continues to run until it next yields or returns.
If this property is changed from false to true, a fresh run of the script is started. This means that Enabled can be toggled to restart a script.
| Thread safety | ReadSafe |
|---|---|
| Category | Behavior |
| Loaded/Saved | false |
LinkedSource
| Type | Default | |
|---|---|---|
| ContentId | ||
The content ID of an uploaded script. When set binds the uploaded code to the script's Script.Source.
By default, this property is set to '[Embedded]'. This means the source of the script is not linked to an upload script and is instead written in the script.
1
| |
Developers should remove a linked source via the properties window, rather than setting the property to '[Embedded]'.
For the LinkedSource property for ModuleScripts, please see ModuleScript.LinkedSource.
| Thread safety | ReadSafe |
|---|---|
| Category | Data |
| Loaded/Saved | true |
History 8
- 731 Change Default of LinkedSource from to
- 726 Change Default of LinkedSource from to
- 645 Change ValueType of LinkedSource from Content to ContentId
- 614 Change Tags of LinkedSource from [] to [Deprecated]
- 553 Change Default of LinkedSource from to
- 486 Change ThreadSafety of LinkedSource from ReadOnly to ReadSafe
- 462 Change ThreadSafety of LinkedSource from to ReadOnly
- 47 Add LinkedSource
RunContext
| Type | Default | |
|---|---|---|
| RunContext | ||
Determines the context under which the script runs. Only available for Scripts, not LocalScripts.
When set to Legacy, Scripts only run when parented to
certain containers. See
Script types and locations.
If RunContext is assigned while the script is running, the engine drops
its references to that thread, and a fresh run of the script is started
under the new context (if possible). A thread that is actively executing
continues to run until it next yields or returns.
| Write security | PluginSecurity |
|---|---|
| Thread safety | ReadSafe |
| Category | Behavior |
| Loaded/Saved | true |
History 5
- 731 Change Default of RunContext from to
- 726 Change Default of RunContext from to
- 566 Change ReadSecurity of RunContext from PluginSecurity to None
- 553 Change Default of RunContext from to
- 534 Add RunContext