InstanceDataHolder
A very simple class for storing data for instances.
Functions
new
InstanceDataHolder.
new
(
) →
(
)
Creates and returns a new instance data holder.
is
InstanceDataHolder.
is
(
self:
any
) →
boolean
Returns true
if the given object is a InstanceDataHolder.
instanceData
Returns the data of the given instance
stored in the instance data holder. If it does not exist,
then a new one (an empty table) will be created for it and returned instead.
Automatic cleanup
When instance
is destroyed, the data stored for it will be automatically cleaned up.
WARNING
instance
must not be parented to nil
- if so, then this method will throw an error.
cleanupForInstance
Cleans up the given instance
's data stored in the instance data holder, if it exists.
TIP
Usually you don't really have to call this method as stored instance data are automatically cleaned up once the instances are destroyed, but this method exists to give the developer more control.
cleanupForAll
InstanceDataHolder:
cleanupForAll
(
) →
(
)
Cleans up all instance data stored in the instance data holder.
destroy
InstanceDataHolder:
destroy
(
) →
(
)
Calls InstanceDataHolder:cleanupForAll and destroys the instance data holder, rendering it unusable.