FriendPages
非推奨を表示
作成できません
複製されていません
FriendPages is a special version of Pages returned by Players:GetFriendsAsync(). The items contained within include information about a player's friends and have the following structure:
Name | Type | Description |
DisplayName | string | The current display name of the friend. |
Id | int64 | The user ID of the friend. |
IsOnline | boolean | Whether the user is currently online. |
Username | string | The username of the friend. |
See the code samples for how to iterate over a player's friends.
コードサンプル
Print Roblox Friends
local Players = game:GetService("Players")
local USERNAME = "Cozecant"
local function iterPageItems(pages)
return coroutine.wrap(function()
local pagenum = 1
while true do
for _, item in ipairs(pages:GetCurrentPage()) do
coroutine.yield(item, pagenum)
end
if pages.IsFinished then
break
end
pages:AdvanceToNextPageAsync()
pagenum = pagenum + 1
end
end)
end
-- First, get the user ID of the player
local userId = Players:GetUserIdFromNameAsync(USERNAME)
-- Then, get a FriendPages object for their friends
local friendPages = Players:GetFriendsAsync(userId)
-- Iterate over the items in the pages. For FriendPages, these
-- are tables of information about the friend, including Username.
-- Collect each username in a table
local usernames = {}
for item, _pageNo in iterPageItems(friendPages) do
table.insert(usernames, item.Username)
end
print("Friends of " .. USERNAME .. ": " .. table.concat(usernames, ", "))
概要
プロパティ
Pages から継承した プロパティ- 読み取り専用複製されていません並列読み取り
Whether or not the current page is the last page available.
方法
Pages から継承した 方法Returns the items on the current page. The keys in the item are determined by the source of this object.
- イールド
Iterates to the next page in the pages object, if possible.
プロパティ
プロパティ は Pages から継承されました
方法
プロパティ は Pages から継承されました