/ HALion Developer Resource / HALion Script / Diving Deeper /

Script Initialization

When a program with a script is loaded into the Slot Rack, the global statements, all parameters and the onLoad, onLoadIntoSlot and onInit callbacks must be initialized. The order is as follows:

#Initialization ofDescriptionThread
1.Global statementsGlobal statements are any expressions outside a function call.Controller
2.ParametersAll parameters of the program, including the parameters that you defined in the script.Controller
3.onLoadThis callback function is called when the script module is loaded as part of a preset or project.Controller
4.onLoadIntoSlotThis callback function is called when the program is loaded into the Slot Rack.Controller
5.onInitThis is the first callback function that is called when the processor thread is initialized.Processor

For more details about threads, see Threads in HALion.

Example

-- Script for testing the initialization when loading a program into the Slot Rack.
 
function onInit()
  print("onInit")  -- This is printed last, after onLoadIntoSlot.
end
 
function onLoadIntoSlot()
  print("onLoadIntoSlot")  -- This is printed after onLoad.
end
 
function onLoad()
  print("onLoad")  -- This is printed after the global statement.
end
 
print("Global statement") -- This is printed first.