A script is a type of Asset where you can write Lua code. The code contained in your script can be anything from game logic to drawing code.
Once attached to the Handler of an existing resource; events associated with the resource will be triggered at runtime or during the drawing process.
In order for your scripts to respond to these events, your code should contain predefined functions that match the events triggered by the resource it is attached to. Refer to the resource help page to learn more about which event it respond to and what are the expected functions that should be implemented.
See Also
Name | Description |
---|---|
asset | Reference to the parent Asset where the Script is defined. |
source | Stream that contains the raw source code of the Script. |
binary | Binary Stream that contains the precompiled code of the Script. |
nodetree | Reference to the NodeTree attached to the Script. |
breakpoint_count | Total amount of Breakpoint currently associated to a line in the Script. |
Name | Description |
---|---|
revision | Current revision of the Script. |
activate_breakpoints | Control wheter or not Breakpoint should be enabled or disabled. |
event_mask | Bit mask created from the EventType cap detected in the Script. |
Name | Description |
---|---|
GetBreakpoint | Return the Breakpoint located on a specific line. |
AddBreakpoint | Create a new Breakpoint. |
SetBreakpoint | Specify if the Breakpoint at a specific line should be toggled on/off. |
RemoveBreakpoint | Remove a Breakpoint located on a specific line. |
UseNodes | Toggle wheter or not the Script should be using a NodeTree. |
IsUsingNodes | Helper that evaluates if a Script is using nodes or not. |
Update | Manually force the active Script to be updated. |
Build | Precompile the active Script by converting raw code to binary code ready to be executed by the virtual machine. |
A small structure that defines a breakpoint in a Script active code.
Name | Description |
---|---|
line | The line number where the Breakpoint is placed. |
enabled | Boolean value that represent if the Breakpoint is activated or not. |
To expose a variable to the LvmThread responsible for handling the coroutine of the Script, all you have to do is to define a local
variable outside of a function.
Once defined this variable value can then be manipulated the same way as member variables. It can be accessed and modified by another Script; Utility etc... Please refer to the LvmThread help page to learn how to access and modify existing local variables defined in a Script.
|