Klasa silnika
ReflectionService
*Ta zawartość została przetłumaczona przy użyciu narzędzi AI (w wersji beta) i może zawierać błędy. Aby wyświetlić tę stronę w języku angielskim, kliknij tutaj.
Podsumowanie
Metody
GetClass(className: string,filter: Dictionary):ReflectedClass? |
GetClasses(filter: Dictionary):{ReflectedClass} |
GetEventsOfClass(className: string,filter: Dictionary):{ReflectedEvent} |
GetMethodsOfClass(className: string,filter: Dictionary):{ReflectedMethod} |
GetPropertiesOfClass(className: string,filter: Dictionary):{ReflectedProperty} |
Przykłady kodu
Przegląd ReflectionService
local ReflectionService = game:GetService("ReflectionService")
-- Utwórz obiekt SecurityCapabilities z wszystkimi możliwościami
local allCapabilities = SecurityCapabilities.new(table.unpack(Enum.SecurityCapability:GetEnumItems()))
-- Pobierz wszystkie klasy dostępne z wszystkimi możliwościami
local allClasses = ReflectionService:GetClasses({ Security = allCapabilities })
print("Łączna liczba klas:", #allClasses)
-- Pobierz konkretną klasę
local partClass = ReflectionService:GetClass("Part")
if partClass then
print("\nKlasa Part:")
print(" Nazwa:", partClass.Name)
print(" Klasa nadrzędna:", partClass.Superclass and tostring(partClass.Superclass) or "brak")
end
-- Pobierz pierwsze 5 właściwości klasy
local properties = ReflectionService:GetPropertiesOfClass("Part", { Security = allCapabilities })
print("\nWłaściwości Part:", #properties)
for i = 1, math.min(5, #properties) do
print(" -", properties[i].Name)
endMateriały referencyjne dotyczące interfejsów API
Metody
GetClass
Parametry
| Wartość domyślna: "nil" |
Zwroty
ReflectedClass?
GetClasses
Parametry
| Wartość domyślna: "nil" |
Zwroty
{ReflectedClass}
GetEventsOfClass
Parametry
| Wartość domyślna: "nil" |
Zwroty
{ReflectedEvent}
GetMethodsOfClass
Parametry
| Wartość domyślna: "nil" |
Zwroty
{ReflectedMethod}
GetPropertiesOfClass
Parametry
| Wartość domyślna: "nil" |
Zwroty
{ReflectedProperty}