The base structure that manages independent coroutines. For each handler, multiple threads (or in this case coroutine) can be created where each of them is in turn attached to a Script. This concept maximizes re-usability avoiding to have a large amount of duplicated code scattered among multiple scripts.

Handlers are attached to a multitude of resources such as Object and Asset, but are also contained in sub-resources (MiscType) like Action or Channel.

See Also

Static Variables

Name Description
lvmthread_count Current amount of LvmThread maintained by the active Handler.
localbounds Identifier of the underlying resource type associated to the current Handler.


Name Description
AddThread Create a new LvmThread for the Handler to maintain.
GetThread Retrieve a specific thread by index.
GetThreadAt Retrieve a specific thread by index.
GetThreadIndex Retrieve the index of a specific LvmThread.
SetThreadIndex Change the index of a specific thread.
RemoveThread Remove a specific LvmThread from the Handler stack.
RemoveThreadAt Remove a specific LvmThread using its index.
SwapThreads Swap two LvmThread by index.
CanDispatchEvent Test if the Handler is responding to a specific EventType.
DispatchEvent Manually dispatch either a C/C++ or Lua event.
DispatchEventC Manually dispatch a C/C++ event.
DispatchEventL Manually dispatch a Lua event.


Type of events that a Script or a C/C++ plugin can respond to. To learn which resources respond to which callback check the Event section of its associated help page.

  • kOnStart: Application specific callback executed when the app. starts.
  • kOnStop: Application and playback specific resources (such as Channel, Sequence etc...) this callback executed once when the Stop function is called.
  • kOnLoad: Called when the Application is about to load a Scene.
  • kOnUnload: Called when the Application is about to unload a Scene.
  • kOnCreate: Specific to ParticleEmitter this callback is executed when new particles are created and for Object when it is constructed.
  • kOnDestroy: Called when a ParticleEmitter destroys particles, and for Object when it is about to be deleted by the scene garbage collector.
  • kOnDraw: Applied to resources that are drawing. This callback is called when a resource like Scene or Material, are ready to draw.
  • kOnDisplay: Also applied to resources that are drawing something; this function is called right after the draw.
  • kOnUpdate: Apply to all type of resources that need an update. This callback is triggered right after their update.
  • kOnBegin: Apply to Camera (before drawing to a FrameBuffer) and Scene (right before switching to the next RenderLayer)
  • kOnEnd: Apply to Camera (right after the FrameBuffer draw is executed) and Scene (right after finishing processing a RenderLayer).
  • kOnPlay: Specific to all resources that require a playback like SoundSource, Video, and ParticleSystem to name a few. This trigger is executed when the Play function successfully executed.
  • kOnPause: Specific to all resources that require a playback such as SoundSource, Video, and ParticleSystem etc... This trigger is executed when the Pause function successfully executed.
  • kOnResume: Specific to all resources that require a playback: SoundSource, Video, and ParticleSystem and the like. This trigger is executed when the resource state was paused and the Play function was called again.
  • kOnActuator: Channel specific triggered when the scrubber hit an actuator is encountered (see Channel for more information).
  • kOnEnter: Associated with ActionController (occur each time the controller enter a new state) and Region (a new Object enters the region).
  • kOnState: Happen each time an ActionController state is updated.
  • kOnLeave: Available for ActionController (the state is about to change) and Region (an Object leave the region).
  • kOnOverlay: Specific to Region; callback is triggered as long as at least one Object overlap the region.
  • kOnOverlap: Happens when two PhysicObject axis-aligned bounding box overlap.
  • kOnCollide: Occur as long as two PhysicObject are colliding.
  • kOnContact: triggered when contact between two PhysicObject happens.
  • kOnHit: Ray specific callback triggered upon a successful ray hit.
  • kOnProximity: Apply to Sensor, and is executed when a resource that has passed the filtering phase is inside the sensor radius.
  • kOnAdd: Happens when a new Object is added to a Scene.
  • kOnRemove: Happens when an Object is removed from a Scene.
  • kOnTrigger: Called each time a Sequence trigger is encountered.
  • kOnTouchesBegan: Manage by Application this callback is triggered when a touche or a mouse click happens.
  • kOnTouchesMoved: Application specific, triggered each time the active pointing device (mouse or touche) is moving on screen.
  • kOnTouchesEnded: Happens when then pointing device is released (Application specific).
  • kOnAccelerometer: Handled by the Application this callback is called on accelerometer update.
  • kOnGyroscope: Handled by the Application this callback is called on gyroscope update.
  • kOnGamepad: Application specific, this callback is triggered when a gamepad is connected or disconnected.
  • kOnGamepadAxis: Happens when a gamepad axis is pressed (Application).
  • kOnGamepadButtons: Happens when a gamepad button is pressed (Application).
  • kOnKeyboard: Application callback triggered when a keyboard key is pressed or released.
  • kOnIgnoreNotResponding: Prevent the built-in scripting mechanism to invalidate the LvmThread if it is not responding for more than 2sec. To deactivate this protection simply add at the top of your Script or Utility the following line: -- IGNORE_NOT_RESPONDING.

NRG - API 2022.4.384543 - Fri Nov 4 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA