エンジンクラス
ReflectionService
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
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("\nPart クラス:")
print(" 名前:", partClass.Name)
print(" スーパークラス:", partClass.Superclass and tostring(partClass.Superclass) or "なし")
end
-- クラスの最初の 5 つのプロパティを取得します
local properties = ReflectionService:GetPropertiesOfClass("Part", { Security = allCapabilities })
print("\nPart プロパティ:", #properties)
for i = 1, math.min(5, #properties) do
print(" -", properties[i].Name)
endAPIリファレンス
方法
GetClass
パラメータ
| 既定値: "nil" |
戻り値
ReflectedClass?
GetClasses
パラメータ
| 既定値: "nil" |
戻り値
{ReflectedClass}
GetEventsOfClass
パラメータ
| 既定値: "nil" |
戻り値
{ReflectedEvent}
GetMethodsOfClass
パラメータ
| 既定値: "nil" |
戻り値
{ReflectedMethod}
GetPropertiesOfClass
パラメータ
| 既定値: "nil" |
戻り値
{ReflectedProperty}