ZH-CN/GetAllAccountData: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (Created page with "__NOTOC__ {{Server function}} This function returns a table containing all the user data for the account provided ==Syntax== <syntaxhighlight lang="lua"> table getAllAccou...") |
Fernando187 (talk | contribs) (Remove obsolete Requirements section) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
此函数返回一个表,其中包含所提供帐户[[account]]的所有用户数据 | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
table getAllAccountData ( account theAccount ) | table getAllAccountData ( account theAccount ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN||[[account]]:getAllData|data|}} | ||
=== | ===必填参数=== | ||
*'''theAccount:''' | *'''theAccount:''' 要从中调取所有数据的帐户 | ||
=== | ===返回值=== | ||
包含所有用户数据的[[表]]。这张表可能是空的. | |||
== | ==示例== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function printAllData ( thePlayer ) | function printAllData ( thePlayer ) | ||
Line 31: | Line 31: | ||
addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall' | addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Account functions}} | {{Account functions}} | ||
[[en:getAllAccountData]] | |||
[[ru:getAllAccountData]] | |||
[[zh-cn:GetAllAccountData]] | [[zh-cn:GetAllAccountData]] |
Latest revision as of 17:27, 7 November 2024
此函数返回一个表,其中包含所提供帐户account的所有用户数据
语法
table getAllAccountData ( account theAccount )
OOP 语法 什么是OOP?
- 方法: account:getAllData(...)
- 变量: .data
必填参数
- theAccount: 要从中调取所有数据的帐户
返回值
包含所有用户数据的表。这张表可能是空的.
示例
function printAllData ( thePlayer ) local playerAccount = getPlayerAccount( thePlayer ) -- get his account if ( playerAccount ) then -- if we got the account then local data = getAllAccountData( playerAccount ) -- get data count = 0 for _ in pairs(data) do count = count + 1 end -- get the count outputChatBox ( "table holds " .. count .. " entries" ) -- output number of rows if ( data ) then for k,v in pairs ( data ) do outputChatBox(k..": "..v) -- print the key and value of each entry of data end end end end addCommandHandler( "getall", printAllData ) -- add a command handler for command 'getall'
See Also
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName