Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/corecii/roblox-instancedestroyed
Detects when an Instance will never re-appear in the game tree. Fires on Destroy and garbage-collection.
https://github.com/corecii/roblox-instancedestroyed
Last synced: 12 days ago
JSON representation
Detects when an Instance will never re-appear in the game tree. Fires on Destroy and garbage-collection.
- Host: GitHub
- URL: https://github.com/corecii/roblox-instancedestroyed
- Owner: Corecii
- License: mit
- Created: 2017-12-05T05:57:46.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-05T08:38:12.000Z (about 7 years ago)
- Last Synced: 2024-10-28T02:30:41.280Z (2 months ago)
- Language: Lua
- Size: 16.6 KB
- Stars: 1
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Documentation
This module can be used to detect when an instance is destroyed at any point after it is used on the object.
It will detect when the object is `Destroy`ed from the game hierarchy, when it is `Destroy`ed from nil, and when it is garbage-collected.
The call returns a pseudo-signal which can be used to check if the function is connected and can be used to disconnect the on-destroy-function without causing it to fire.
* pseudoSignal module(Instance instance, function func)
Attach the function 'func' to be called when the Instance 'instance' is destroyed* pseudoSignal
* boolean .connected, .Connected
If the function provided is still connected then this is true. When the object is destroyed this is set to false before the function is called.
This can only be false if the object is destroyed or if this is manually disconnected.* void :disconnect(), :Disconnect()
Manually disconnects the connected function before the object is destroyed.* RBXScriptSignal .connection
This is the actual connection to the instance's AncestryChanged event. This should not be messed with.# Changes pre-git-repo
* Edit 5:
Clarify comments on coroutine.yield because behavior has changed from [end of current execution cycle] to [beginning of next execution cycle]
* Version 4:
Fixed garbage collection detection.
* Edit 3:
Clarified/fixed some terminology. (comments only)
* Version 2:
Made it not prevent garbage collection by using ObjectValues
* Version 1:
InitialSee original Gist for diffs: https://gist.github.com/Corecii/2c86fb338802a618e3ff376d61409b1b