FriendPages

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
복제되지 않음

FriendPages는 Pages 에 의해 반환된 특별한 버전입니다. 아이템에 포함된 정보는 플레이어의 친구에 대한 정보를 포함하며 다음과 같은 구조를 가집니다.


<tr>
<td><code>표시 이름</code></td>
<td>문자열</td>
<td>친구의 현재 디스플레이 이름입니다.</td>
</tr>
<tr>
<td><code>Id</code></td>
<td>int64</td>
<td>친구의 ID입니다.</td>
</tr>
<tr>
<td><code>사용자 이름</code></td>
<td>문자열</td>
<td>친구의 사용자 이름입니다.</td>
</tr>
이름유형설명

플레이어의 친구를 반복하는 방법에 대한 코드 샘플을 참조하십시오.

코드 샘플

This code sample loads the Player.UserId of the player whose username is provided at the top of the script by using Players:GetUserIdFromNameAsync(). Then, it gets a FriendPages object by calling Players:GetFriendsAsync() and iterates over each entry using the iterPageItems function. The username of each friend is stored in a table, then printed at the end.

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에서 상속되었습니다
  • 읽기 전용
    복제되지 않음
    병렬 읽기

    현재 페이지가 사용 가능한 마지막 페이지인지 여부.

메서드

메서드Pages에서 상속되었습니다
  • 현재 페이지의 항목을 반환합니다. 항목의 열은 이 개체의 원본에 따라 결정됩니다.

  • 페이지 개체의 다음 페이지로 이터레이트, 가능하면.

속성

메서드

이벤트