pub struct LuaNotificationQueue;Expand description
Object that keeps track of objects invalidation and queues notifications for when object becomes invalid.
This object is an alternative mechanism to LuaBootstrap::register_on_object_destroyed where instead of raising lua events, this object only queues notifications and makes them available to use later by calls to LuaNotificationQueue::poll or LuaNotificationQueue::poll_all.
New instances of this object can be obtained from LuaBootstrap::new_notification_queue.
Each instance of this object is unique, always valid and cannot be copied. This object lives entirely in script state and if its no longer referenced by script, it will be destroyed by garbage collector.
Implementations§
Source§impl LuaNotificationQueue
impl LuaNotificationQueue
Sourcepub fn object_name(&self) -> &str
pub fn object_name(&self) -> &str
The class name of this object. Available even when valid is false. For LuaStruct objects it may also be suffixed with a dotted path to a member of the struct.
Sourcepub fn valid(&self) -> bool
pub fn valid(&self) -> bool
Is this object valid? This Lua object holds a reference to an object within the game engine. It is possible that the game-engine object is removed whilst a mod still holds the corresponding Lua object. If that happens, the object becomes invalid, i.e. this attribute will be false. Mods are advised to check for object validity if any change to the game state might have occurred between the creation of the Lua object and its access.
Sourcepub fn add(&self, object: LuaAny) -> u64
pub fn add(&self, object: LuaAny) -> u64
Registers an object so that after it’s destroyed, a notification is queued.
If this object is already registered within this notification queue, an existing registration number will be provided without creating new registration.
Sourcepub fn find(&self, object: LuaAny) -> Option<u64>
pub fn find(&self, object: LuaAny) -> Option<u64>
Checks if provided object is already registered and returns existing registration number for it. If object is not registered, it is not registered and nil is returned instead.
Trait Implementations§
Source§impl Clone for LuaNotificationQueue
impl Clone for LuaNotificationQueue
Source§fn clone(&self) -> LuaNotificationQueue
fn clone(&self) -> LuaNotificationQueue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more