FriendPages

Artık kullanılmayanları göster

*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.

Oluşturulamaz
Çoğaltılmamış

FriendPages, Pages tarafından döndürülen özel bir versiyondur. Players:GetFriendsAsync() .İçinde bulunan öğeler bir oyuncunun arkadaşları hakkında bilgi içerir ve şu yapıya sahiptir:


<th>Tür</th>
<th>Açıklama</th>
</tr>
<tr>
<td><code>Görüntüleme Adı</code></td>
<td>dizi</td>
<td>arkadaşmevcut görüntü adı.</td>
</tr>
<tr>
<td><code>Id</code></td>
<td>int64</td>
<td>arkadaşkullanıcı ID'si.</td>
</tr>
<tr>
<td><code>Kullanıcı adı</code></td>
<td>dizi</td>
<td>arkadaşkullanıcı adı.</td>
</tr>
Adı

Bir oyuncunun arkadaşlarını nasıl döndüreceğinize dair kod örneklerini görün.

Kod Örnekleri

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 connection is stored in a table, then printed at the end.

Print Roblox Connections

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 connections
local friendPages = Players:GetFriendsAsync(userId)
-- Iterate over the items in the pages. For FriendPages, these
-- are tables of information about the connection, including Username.
-- Collect each username in a table
local usernames = {}
for item, _pageNo in iterPageItems(friendPages) do
table.insert(usernames, item.Username)
end
print("Connections of " .. USERNAME .. ": " .. table.concat(usernames, ", "))

Özet

Özellikler

Şuradan alınan Özellikler: Pages

Özellikler

  • Salt Okunur
    Çoğaltılmamış
    Paralel oku

    Mevcut sayfa mevcut sayfa olup olmadığı, son sayfa olup olmadığı.

Yöntemler

Şuradan alınan Yöntemler: Pages

Yöntemler

  • Mevcut sayfadaki öğeleri döndürür. Öğenin anahtarları bu nesnenin kaynağı tarafından belirlenir.

  • Mümkünse, sayfa nesnesinde bir sonraki sayfaya yeniden döner.

Özellikler

Yöntemler

Olaylar