ไวยากรณ์
GetObjects(context: DataModel, asset: string): { Instance }Arguments
| ชื่อ | ชนิด | คำอธิบาย |
|---|---|---|
context | DataModel | Method-call self value. Use game:GetObjects(asset). |
asset | string | Asset string passed to Roblox local asset loading. |
Returns
| ชื่อ | ชนิด | คำอธิบาย |
|---|---|---|
objects | { Instance } | Table whose first element is the loaded Instance. |
คำอธิบาย
Loads a local Roblox asset and returns a one-item table containing the loaded Instance. Use the method-call form game:GetObjects(asset).
เรียกด้วย parameter 2 ค่า: context, asset ตาราง arguments อธิบายค่าที่จำเป็นและค่าที่ปรับพฤติกรรม
ส่งคืน objects ({ Instance }) ใช้ตาราง returns เพื่อแยกค่าที่สำเร็จ ผลลัพธ์ nil และ error ที่จัดการต่อได้
ตัวอย่าง
Load a local asset through Roblox local asset loading and return it in a one-item table.
local objects = game:GetObjects("rbxassetid://123456789")
local object = objects[1]
if object then
print(object.Name)
end