getmodules
Returns all ModuleScript instances known to the instance cache.
Syntax
getmodules() -> table
Parameters
This function takes no parameters.
Returns
| Type | Description |
|---|---|
table | All ModuleScript instances currently known to the cache. |
Description
getmodules walks the instance cache and returns every userdata whose ClassName is ModuleScript.
The result is an array and does not require the module to be currently running.
Example
for _, module in ipairs(getmodules()) do
print(module:GetFullName())
end
Notes
- Returned instances are live proxies; they can become invalid if the object is destroyed.
- Uses the module instance cache, not the script heap.