ActorBox - stingray.ActorBox object reference - Stingray Lua API Reference
A "box" that stores an Actor object across multiple frames, ensuring that the stored Actor has not become invalid by being destroyed in the physics world.
When you need a reference to an actor to persist across multiple frames, you can call ActorBox.store() to store the actor in an ActorBox, and
ActorBox.unbox() to retrieve the stored values.
|
Stores the specified actor in the specified box.
|
Parameters self : | stingray.ActorBox | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. |
actor : | stingray.Actor | The physics actor to store to the box. |
Returns | This function does not return any values. |
If actor is nil, the box is cleared.
|
unbox ( self ) : nil, stingray.Actor
Retrieves the stored actor from the box, if any.
|
Parameters self : | stingray.ActorBox | Specifies the object instance that this function will act on. You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation. |
Returns stingray.Actor |
The actor last stored in the box, if it is still valid. If the box is empty, or if the actor last stored
in the box has been destroyed in the physics world, returns nil.
|