ZH-CN/aclList

From Multi Theft Auto: Wiki
Revision as of 07:02, 6 February 2021 by Qwe7769611 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

此函数返回所有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