tuple 列表

*此内容使用人工智能(Beta)翻译,可能包含错误。若要查看英文页面,请点按 此处

一个 tuple 是一列值。Roblox 引擎 API 方法 和 回调 中的许多方法和回调接受和返回多个值,但 API 参考书说“ tuple ”而不是这些值。

参数

如果 方法回调 接受 tuple 作为参数,那么它接受多个值。例如,API 参考显示,BindableFunction:Invoke() 方法接受一个 "Tuple" 作为参数,因此接受多个参数。


BindableFunction:Invoke(1, true, "string", Vector3.new(0, 0, 0))

返回

如果 方法回调 返回 tuple,那么它返回多元组值。例如,API 参考显示,Players:GetUserThumbnailAsync() 方法返回一个 "Tuple",因此返回多个值。第一个返回值是内容 URL,第二个是 boolean


local Players = game:GetService("Players")
local userId = 156 -- 建筑工
local thumbType = Enum.ThumbnailType.HeadShot
local thumbSize = Enum.ThumbnailSize.Size420x420
local content, isReady = Players:GetUserThumbnailAsync(userId, thumbType, thumbSize)
print(content, isReady) -- rbxthumb://type=AvatarHeadShot&id=156&w=420&h=420 true

在此页面