ZH-CN/aclList: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) (Created page with "__NOTOC__ {{Server function}} This function returns a list of all the ACLs. ==Syntax== <syntaxhighlight lang="lua"> table aclList () </syntaxhighlight> {{OOP|This functio...") |
Qwe7769611 (talk | contribs) No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
此函数返回所有ACL的列表. | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
table aclList () | table aclList () | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN|This function is a static function underneath the ACL class.|[[ACL]].list||}} | ||
=== | ===返回值=== | ||
返回所有ACL的表。如果不存在ACL,则此表可以为空。如果由于某种原因失败,它还可以返回“false”/“nil”. | |||
== | ==示例== | ||
此示例添加了一个命令“listacls”,它将所有acl的名称列表打印到控制台. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function printOutAllACLs ( thePlayer ) | function printOutAllACLs ( thePlayer ) | ||
-- | -- 在所有ACL上建立一个表 | ||
local allACLs = aclList() | local allACLs = aclList() | ||
-- | -- 如果表为空(没有ACL) | ||
if #allACLs == 0 then | if #allACLs == 0 then | ||
-- | -- 发送消息到控制台并退出功能 | ||
return outputConsole ( "There are no ACLs!", thePlayer ) | return outputConsole ( "There are no ACLs!", thePlayer ) | ||
else | else | ||
-- | -- 发送名单列表 | ||
outputConsole ( "List of all ACLs:", thePlayer ) | outputConsole ( "List of all ACLs:", thePlayer ) | ||
for key, singleACL in ipairs ( allACLs ) do | for key, singleACL in ipairs ( allACLs ) do | ||
Line 35: | Line 35: | ||
==See Also== | ==See Also== | ||
{{ACL_functions}} | {{ACL_functions}} | ||
[[ | [[en:aclList]] |
Latest revision as of 07:02, 6 February 2021
此函数返回所有ACL的列表.
语法
table aclList ()
OOP 语法 什么是OOP?
- 提示: This function is a static function underneath the ACL class.
- 方法: ACL.list(...)
返回值
返回所有ACL的表。如果不存在ACL,则此表可以为空。如果由于某种原因失败,它还可以返回“false”/“nil”.
示例
此示例添加了一个命令“listacls”,它将所有acl的名称列表打印到控制台.
function printOutAllACLs ( thePlayer ) -- 在所有ACL上建立一个表 local allACLs = aclList() -- 如果表为空(没有ACL) if #allACLs == 0 then -- 发送消息到控制台并退出功能 return outputConsole ( "There are no ACLs!", thePlayer ) else -- 发送名单列表 outputConsole ( "List of all ACLs:", thePlayer ) for key, singleACL in ipairs ( allACLs ) do local ACLName = aclGetName ( singleACL ) outputConsole ( "- " .. tostring ( ACLName ), thePlayer ) end end end addCommandHandler ( "listacls", printOutAllACLs )
See Also
- aclCreate
- aclCreateGroup
- aclDestroy
- aclDestroyGroup
- aclGet
- aclGetGroup
- aclGetName
- aclGetRight
- aclGroupAddACL
- aclGroupAddObject
- aclGroupGetName
- aclGroupList
- aclGroupListACL
- aclGroupListObjects
- aclGroupRemoveACL
- aclGroupRemoveObject
- aclList
- aclListRights
- aclReload
- aclRemoveRight
- aclSave
- aclSetRight
- hasObjectPermissionTo
- isObjectInACLGroup