ZH-CN/AclGetName: Difference between revisions
Jump to navigation
Jump to search
Qwe7769611 (talk | contribs) No edit summary |
Qwe7769611 (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
获取给定ACL的名称. | |||
== | ==语法== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
string aclGetName ( acl theAcl ) | string aclGetName ( acl theAcl ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ | {{OOP_ZH-CN||[[acl]]:getName|name|}} | ||
=== | ===必填参数=== | ||
*'''theACL:''' | *'''theACL:''' 要获取其名称的ACL | ||
=== | ===返回值=== | ||
如果成功,则以字符串形式返回给定ACL的名称。如果不成功,则返回“false”/“nil”,即ACL无效. | |||
== | ==示例== | ||
此示例添加命令“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 |
Revision as of 03:41, 6 February 2021
获取给定ACL的名称.
语法
string aclGetName ( acl theAcl )
OOP 语法 什么是OOP?
- 方法: acl:getName(...)
- 变量: .name
必填参数
- theACL: 要获取其名称的ACL
返回值
如果成功,则以字符串形式返回给定ACL的名称。如果不成功,则返回“false”/“nil”,即ACL无效.
示例
此示例添加命令“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