Syntax
getinstancesbyclass(className: string): tablegetinstancesofclassArguments
| Name | Type | Description |
|---|---|---|
className | string | Exact ClassName string to match. Empty strings raise "ClassName required". |
Returns
| Name | Type | Description |
|---|---|---|
instances | table | New array table containing matching object values from the Instance cache table. |
Description
Returns instances from the Instance cache table whose ClassName field exactly matches the requested string. The first argument is required to be a string. An empty string raises "ClassName required". The function creates a new array table, iterates the cache stored under Instance cache, keeps only values whose Lua type is object, reads each object value's ClassName field, and compares it with strcmp against the requested className. Matches are inserted sequentially starting at index 1. The match is exact and case-sensitive. The function does not use IsA, does not include subclasses, does not walk descendants, does not filter by Parent, and does not sort the result. getinstancesofclass is an alias for the same function.
Call it with 1 parameter(s): className. The argument table explains which values are required and which ones only refine the behavior.
It returns instances (table). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = getinstancesbyclass("example")
print(result)