mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
rules
This commit is contained in:
parent
a9b4f8e83b
commit
e6efc04756
8494 changed files with 495610 additions and 0 deletions
|
|
@ -0,0 +1,255 @@
|
|||
# This file is automatically generated. Please don't edit it manually.
|
||||
# To submit a bug report on the content, see
|
||||
# https://devforum.roblox.com/c/bug-reports/documentation-issues/72
|
||||
|
||||
name: ReflectionService
|
||||
type: class
|
||||
memory_category: Instances
|
||||
summary: ''
|
||||
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, 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:
|
||||
|
||||
```lua
|
||||
local ReflectionService = game:GetService("ReflectionService")
|
||||
|
||||
-- Create a SecurityCapabilities object with all capabilities
|
||||
local allCapabilities = SecurityCapabilities.new(table.unpack(Enum.SecurityCapability:GetEnumItems()))
|
||||
|
||||
-- Get all classes accessible with all capabilities
|
||||
local allClasses = ReflectionService:GetClasses({ Security = allCapabilities })
|
||||
print("Total classes:", #allClasses)
|
||||
|
||||
-- Get a specific class
|
||||
local partClass = ReflectionService:GetClass("Part")
|
||||
if partClass then
|
||||
print("\nPart class:")
|
||||
print(" Name:", partClass.Name)
|
||||
print(" Superclass:", partClass.Superclass and tostring(partClass.Superclass) or "none")
|
||||
end
|
||||
|
||||
-- Get the first 5 properties of a class
|
||||
local properties = ReflectionService:GetPropertiesOfClass("Part", { Security = allCapabilities })
|
||||
print("\nPart properties:", #properties)
|
||||
for i = 1, math.min(5, #properties) do
|
||||
print(" -", properties[i].Name)
|
||||
end
|
||||
```
|
||||
code_samples: []
|
||||
inherits:
|
||||
- Instance
|
||||
descendants: []
|
||||
tags:
|
||||
- NotCreatable
|
||||
- Service
|
||||
- NotReplicated
|
||||
deprecation_message: ''
|
||||
properties: []
|
||||
methods:
|
||||
- name: ReflectionService:GetClass
|
||||
summary: |
|
||||
Returns information about a class when given its name, assuming that class
|
||||
is accessible.
|
||||
description: |
|
||||
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:
|
||||
|
||||
```lua
|
||||
{
|
||||
-- The security context to use. Can be more expansive than the current script's security.
|
||||
Security: SecurityCapabilities?, -- default: SecurityCapabilities.fromCurrent()
|
||||
-- Require classes to derive from the passed-in class name.
|
||||
IsA: string?, -- default: nil
|
||||
-- Whether to exclude Studio display information about the class.
|
||||
ExcludeDisplay: boolean?, -- default: false
|
||||
}
|
||||
```
|
||||
|
||||
If the class name is valid, you'll get the following `ReflectedClass`
|
||||
dictionary as output:
|
||||
|
||||
```lua
|
||||
{
|
||||
-- The name of the class.
|
||||
Name: string,
|
||||
-- The class's parent in the instance hierarchy (unless it's the root).
|
||||
Superclass: string?,
|
||||
-- The names of the class's direct children in the instance hierarchy.
|
||||
Subclasses: {string},
|
||||
-- Studio display information.
|
||||
Display: {
|
||||
-- Always "General" for classes.
|
||||
Category: string,
|
||||
-- A message indicating that the class is deprecated, if applicable.
|
||||
DeprecationMessage: string?,
|
||||
}?,
|
||||
-- The security permissions required to access this class.
|
||||
Permits: {
|
||||
-- If the class is a Service, the security capabilities required to obtain access. If not applicable, this field isn't present.
|
||||
GetService: SecurityCapabilities?,
|
||||
-- The security capabilities required to create an instance of this class. If not possible, this field isn't present.
|
||||
New: SecurityCapabilities?,
|
||||
}
|
||||
}
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: className
|
||||
type: string
|
||||
default:
|
||||
summary: |
|
||||
The name of the class for which you wish to retrieve information.
|
||||
- name: filter
|
||||
type: Dictionary
|
||||
default: nil
|
||||
summary: |
|
||||
An optional filter to restrict or expand the set of classes that this
|
||||
method can return and change the method's behavior.
|
||||
returns:
|
||||
- type: Dictionary?
|
||||
summary: |
|
||||
A `ReflectedClass` dictionary with reflection information if the class
|
||||
exists; otherwise, `nil`.
|
||||
tags:
|
||||
- CustomLuaState
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: ReflectionService:GetClasses
|
||||
summary: |
|
||||
Returns a list of all classes accessible with filters applied.
|
||||
description: |
|
||||
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:
|
||||
|
||||
```lua
|
||||
{
|
||||
-- The security context to use. Can be more expansive than the current script's security.
|
||||
Security: SecurityCapabilities?, -- default: SecurityCapabilities.fromCurrent()
|
||||
-- Require classes to derive from the passed-in class name.
|
||||
IsA: string?, -- default: nil
|
||||
-- Whether to exclude Studio display information about the classes.
|
||||
ExcludeDisplay: boolean?, -- default: false
|
||||
}
|
||||
```
|
||||
|
||||
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.
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: filter
|
||||
type: Dictionary
|
||||
default: nil
|
||||
summary: |
|
||||
An optional filter to restrict or expand the set of classes that this
|
||||
method can return and change the method's behavior.
|
||||
returns:
|
||||
- type: Array
|
||||
summary: |
|
||||
A list of `ReflectedClass` dictionaries with reflection information
|
||||
for each class that matches the filter criteria.
|
||||
tags:
|
||||
- CustomLuaState
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
- name: ReflectionService:GetPropertiesOfClass
|
||||
summary: |
|
||||
Returns a list of properties for a given class with filters applied.
|
||||
description: |
|
||||
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:
|
||||
|
||||
```lua
|
||||
{
|
||||
-- The security context to use. Can be more expansive than the current script's security.
|
||||
Security: SecurityCapabilities?, -- default: SecurityCapabilities.fromCurrent()
|
||||
-- Whether to exclude inherited properties from superclasses.
|
||||
ExcludeInherited: boolean?, -- default: false
|
||||
-- Whether to exclude Studio display information about the properties.
|
||||
ExcludeDisplay: boolean?, -- default: false
|
||||
}
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```lua
|
||||
{
|
||||
-- The name of the property.
|
||||
Name: string,
|
||||
-- Whether the property is serialized (able to be saved to disk or sent over the network).
|
||||
Serialized: boolean,
|
||||
-- The type of the property.
|
||||
Type: ReflectionType,
|
||||
-- The content type of the property, if applicable.
|
||||
ContentType: Enum.AssetType?,
|
||||
-- Studio display information.
|
||||
Display: {
|
||||
-- The category under which the property is listed in Studio.
|
||||
Category: string,
|
||||
-- A message indicating that the property is deprecated, if applicable.
|
||||
DeprecationMessage: string?,
|
||||
-- The order in which the property appears in Studio.
|
||||
LayoutOrder: number,
|
||||
}?,
|
||||
-- The security permissions required to access this property.
|
||||
Permits: {
|
||||
-- The security context required to read this property.
|
||||
Read: SecurityCapabilities?,
|
||||
-- The security context required to read this property while thread-safe.
|
||||
ReadParallel: SecurityCapabilities?,
|
||||
-- The security context required to write to this property.
|
||||
Write: SecurityCapabilities?,
|
||||
-- The security context required to write to this property while thread-safe.
|
||||
WriteParallel: SecurityCapabilities?,
|
||||
},
|
||||
}
|
||||
```
|
||||
code_samples: []
|
||||
parameters:
|
||||
- name: className
|
||||
type: string
|
||||
default:
|
||||
summary: |
|
||||
The name of the class for which you wish to retrieve properties.
|
||||
- name: filter
|
||||
type: Dictionary
|
||||
default: nil
|
||||
summary: |
|
||||
An optional filter to restrict or expand the set of properties that
|
||||
this method can return and change the method's behavior.
|
||||
returns:
|
||||
- type: Array
|
||||
summary: |
|
||||
A list of `ReflectedProperty` dictionaries with reflection information
|
||||
for each property of the class that matches the filter criteria.
|
||||
tags:
|
||||
- CustomLuaState
|
||||
deprecation_message: ''
|
||||
security: None
|
||||
thread_safety: Unsafe
|
||||
capabilities: []
|
||||
events: []
|
||||
callbacks: []
|
||||
Loading…
Add table
Add a link
Reference in a new issue