GetAccounts: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server function}} This function returns a table over all the accounts that exist in the server accounts.xml file. ==Syntax== <syntaxhighlight lang="lua"> table getAccounts () </syntaxhighlight> ===Retur...) |
m (Добавление языков) |
||
(16 intermediate revisions by 11 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
This function returns a table over all the | This function returns a table over all the [[account]]s that exist in the server internal.db file. (Note: accounts.xml is no longer used after version 1.0.4) | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
table getAccounts () | table getAccounts () | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP|This function is a static function underneath the Account class.|[[Account]].getAll||}} | |||
===Returns=== | ===Returns=== | ||
A [[table]] over the accounts that exist in the server | A [[table]] over the accounts that exist in the server internal.db file. This table might be empty. | ||
==Example== | ==Example== | ||
Line 15: | Line 15: | ||
local accountTable = getAccounts () -- return the table over accounts | local accountTable = getAccounts () -- return the table over accounts | ||
if #accountTable == 0 then -- if the table is empty | if #accountTable == 0 then -- if the table is empty | ||
outputChatBox( "There | outputChatBox( "There are no accounts. :(", thePlayer ) | ||
else -- table isn't empty | else -- table isn't empty | ||
outputChatBox( "There | outputChatBox( "There are " .. #accountTable .. " accounts in this server!", thePlayer ) | ||
end | end | ||
end | end | ||
addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount' | addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount' | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{Account functions}} | {{Account functions}} | ||
[[ru:getAccounts]] | |||
[[en:getAccounts]] | |||
[[zh-cn:getAccounts]] |
Latest revision as of 13:16, 12 April 2021
This function returns a table over all the accounts that exist in the server internal.db file. (Note: accounts.xml is no longer used after version 1.0.4)
Syntax
table getAccounts ()
OOP Syntax Help! I don't understand this!
- Note: This function is a static function underneath the Account class.
- Method: Account.getAll(...)
Returns
A table over the accounts that exist in the server internal.db file. This table might be empty.
Example
function printAmountOfAccounts ( thePlayer ) local accountTable = getAccounts () -- return the table over accounts if #accountTable == 0 then -- if the table is empty outputChatBox( "There are no accounts. :(", thePlayer ) else -- table isn't empty outputChatBox( "There are " .. #accountTable .. " accounts in this server!", thePlayer ) end end addCommandHandler( "accountcount", printAmountOfAccounts ) -- add a command handler for command 'accountcount'
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