เรียนรู้
Engine Class
ReflectionService
ไม่สามารถสร้าง
บริการ
ไม่ซ้ำ

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่


สรุป
วิธีการ
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}
สมาชิกที่ได้รับทอด
ตัวอย่างโค้ด
ภาพรวมของ ReflectionService
local ReflectionService = game:GetService("ReflectionService")
-- สร้างวัตถุ SecurityCapabilities ที่มีความสามารถทั้งหมด
local allCapabilities = SecurityCapabilities.new(table.unpack(Enum.SecurityCapability:GetEnumItems()))
-- รับคลาสทั้งหมดที่เข้าถึงได้ด้วยความสามารถทั้งหมด
local allClasses = ReflectionService:GetClasses({ Security = allCapabilities })
print("จำนวนคลาสทั้งหมด:", #allClasses)
-- รับคลาสเฉพาะ
local partClass = ReflectionService:GetClass("Part")
if partClass then
print("\nคลาส Part:")
print(" ชื่อ:", partClass.Name)
print(" Superclass:", partClass.Superclass and tostring(partClass.Superclass) or "none")
end
-- รับคุณสมบัติ 5 รายการแรกของคลาส
local properties = ReflectionService:GetPropertiesOfClass("Part", { Security = allCapabilities })
print("\nคุณสมบัติของ Part:", #properties)
for i = 1, math.min(5, #properties) do
print(" -", properties[i].Name)
end

เอกสารอ้างอิงเกี่ยวกับ API
วิธีการ
GetClass
ReflectionService:GetClass(
className:string, filter:Dictionary
):ReflectedClass?
พารามิเตอร์
className:string
filter:Dictionary
ค่าเริ่มต้น: "nil"
ส่งค่ากลับ
ReflectedClass?

GetClasses
ReflectionService:GetClasses(filter:Dictionary):{ReflectedClass}
พารามิเตอร์
filter:Dictionary
ค่าเริ่มต้น: "nil"
ส่งค่ากลับ
{ReflectedClass}

GetEventsOfClass
ReflectionService:GetEventsOfClass(
className:string, filter:Dictionary
):{ReflectedEvent}
พารามิเตอร์
className:string
filter:Dictionary
ค่าเริ่มต้น: "nil"
ส่งค่ากลับ
{ReflectedEvent}

GetMethodsOfClass
ReflectionService:GetMethodsOfClass(
className:string, filter:Dictionary
):{ReflectedMethod}
พารามิเตอร์
className:string
filter:Dictionary
ค่าเริ่มต้น: "nil"
ส่งค่ากลับ
{ReflectedMethod}

GetPropertiesOfClass
ReflectionService:GetPropertiesOfClass(
className:string, filter:Dictionary
):{ReflectedProperty}
พารามิเตอร์
className:string
filter:Dictionary
ค่าเริ่มต้น: "nil"
ส่งค่ากลับ
{ReflectedProperty}

©2026 Roblox Corporation. Roblox, โลโก้ Roblox และ Powering Imagination เป็นส่วนหนึ่งของเครื่องหมายการค้าที่จดทะเบียน และไม่ได้จดทะเบียนของเราในสหรัฐฯ และประเทศอื่นๆ