From Multi Theft Auto: Wiki
Revision as of 22:58, 1 January 2015 by Qaisjp (talk | contribs) (fix oop syntax)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Get the name of given ACL.


string aclGetName ( acl theAcl )

OOP Syntax Help! I don't understand this!

Method: acl:getName(...)
Variable: .name

Required Arguments

  • theACL: The ACL to get the name of


Returns the name of the given ACL as a string if successful. Returns false/nil if unsuccessful, ie the ACL is invalid.


This example adds a command listacls which prints out a name list of all ACLs to the console.

function printOutAllACLs ( thePlayer )
    -- get a table over all the ACLs
    local allACLs = aclList()
    -- if the table is empty (there are no ACLs)
    if #allACLs == 0 then
        -- print out a message to console and exit function
        return outputConsole ( "There are no ACLs!", thePlayer )
        -- print out a list of the names
        outputConsole ( "List of all ACLs:", thePlayer )
        for key, singleACL in ipairs ( allACLs ) do
            local ACLName = aclGetName ( singleACL )
            outputConsole ( "- " .. tostring ( ACLName ), thePlayer )
addCommandHandler ( "listacls", printOutAllACLs )

See Also