ReflectionService
| Memory category | Instances |
|---|
Member index 7
Description
ReflectionService allows scripts to query the engine for details about its
API, including required security permissions, functionality, and inheritance
structure. You can use this service to dynamically inspect classes and their
properties, methods, and events, which can be useful for debugging, tooling,
or creating dynamic behaviors based on the engine's capabilities.
The following is an example script that inspects classes and their properties:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | |
History 13
- 707 Add GetMethodsOfClass
- 707 Add GetEventsOfClass
- 698 Change Tags of GetStyledPropertyNames from [] to [CustomLuaState]
- 698 Change Tags of GetPropertyNames from [] to [CustomLuaState]
- 698 Change Tags of GetPropertiesOfClass from [] to [CustomLuaState]
- 698 Change Tags of GetClasses from [] to [CustomLuaState]
- 698 Change Tags of GetClass from [] to [CustomLuaState]
- 671 Add GetPropertiesOfClass
- 671 Add GetClasses
- 671 Add GetClass
- 668 Add GetStyledPropertyNames
- 596 Add GetPropertyNames
- 596 Add ReflectionService
Members 7
GetClass
| Parameters (2) | Default | |
|---|---|---|
| className | string | |
| filter | Dictionary | nil |
| Returns (1) | ||
| Dictionary? | ||
Given a class name in the Roblox API, returns a ReflectedClass
dictionary with information about the associated class's reflection state.
If no such class name exists, returns nil.
If you pass in a ReflectionClassFilter dictionary, you can adjust the
set of eligible classes and adjust the output behavior:
1 2 3 4 5 6 7 8 | |
If the class name is valid, you'll get the following ReflectedClass
dictionary as output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | |
| Thread safety | Unsafe |
|---|
GetClasses
| Parameters (1) | Default | |
|---|---|---|
| filter | Dictionary | nil |
| Returns (1) | ||
| Array | ||
Returns a list of ReflectedClass dictionaries for all classes in the
Roblox API that match the provided filter criteria.
If you pass in a ReflectionClassFilter dictionary, you can adjust the
set of eligible classes and adjust the output behavior:
1 2 3 4 5 6 7 8 | |
You'll get a list of ReflectedClass dictionaries as output, each with
the same structure as described in the GetClass method. If there are no
classes that match the filter criteria, you'll receive an empty list.
| Thread safety | Unsafe |
|---|
History 2
- 698 Change Tags of GetClasses from [] to [CustomLuaState]
- 671 Add GetClasses
GetEventsOfClass
| Parameters (2) | Default | |
|---|---|---|
| className | string | |
| filter | Dictionary | nil |
| Returns (1) | ||
| Array | ||
Given a class name in the Roblox API, returns a list of ReflectedEvent
dictionaries for all events of that class that match the provided filter
criteria. If no such class name exists, returns nil.
If you pass in a ReflectionMemberFilter dictionary, you can adjust the
set of eligible events and adjust the output behavior:
1 2 3 4 5 6 7 8 | |
If the class name is valid and that class has events, you'll get a list of
ReflectedEvent dictionaries as output, each with the following
structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | |
| Thread safety | Unsafe |
|---|
History 1
- 707 Add GetEventsOfClass
GetMethodsOfClass
| Parameters (2) | Default | |
|---|---|---|
| className | string | |
| filter | Dictionary | nil |
| Returns (1) | ||
| Array | ||
Given a class name in the Roblox API, returns a list of ReflectedMethod
dictionaries for all methods of that class that match the provided filter
criteria. If no such class name exists, returns nil.
If you pass in a ReflectionMemberFilter dictionary, you can adjust the
set of eligible methods and adjust the output behavior:
1 2 3 4 5 6 7 8 | |
If the class name is valid and that class has methods, you'll get a list
of ReflectedMethod dictionaries as output, each with the following
structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
| Thread safety | Unsafe |
|---|
History 1
- 707 Add GetMethodsOfClass
GetPropertiesOfClass
| Parameters (2) | Default | |
|---|---|---|
| className | string | |
| filter | Dictionary | nil |
| Returns (1) | ||
| Array | ||
Given a class name in the Roblox API, returns a list of
ReflectedProperty dictionaries for all properties of that class that
match the provided filter criteria. If no such class name exists, returns
nil.
If you pass in a ReflectionMemberFilter dictionary, you can adjust the
set of eligible properties and adjust the output behavior:
1 2 3 4 5 6 7 8 | |
If the class name is valid and that class has properties, you'll get a
list of ReflectedProperty dictionaries as output, each with the
following structure:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
| Thread safety | Unsafe |
|---|
History 2
- 698 Change Tags of GetPropertiesOfClass from [] to [CustomLuaState]
- 671 Add GetPropertiesOfClass
GetPropertyNames
| Parameters (1) | ||
|---|---|---|
| name | string | |
| Returns (1) | ||
| Array | ||
| Security | RobloxScriptSecurity |
|---|---|
| Thread safety | Unsafe |
History 2
- 698 Change Tags of GetPropertyNames from [] to [CustomLuaState]
- 596 Add GetPropertyNames
GetStyledPropertyNames
| Parameters (1) | ||
|---|---|---|
| name | string | |
| Returns (1) | ||
| Array | ||
| Security | RobloxScriptSecurity |
|---|---|
| Thread safety | Unsafe |
History 2
- 698 Change Tags of GetStyledPropertyNames from [] to [CustomLuaState]
- 668 Add GetStyledPropertyNames