aclGetName | Multi Theft Auto: Wiki Skip to content

aclGetName

Client-side
Server-side
Shared

Get the name of given ACL.

OOP Syntax Help! I don't understand this!

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

Syntax

string|false aclGetName ( acl theAcl )
Required Arguments
  • theAcl: The ACL to get the name of.

Returns

  • string|false: acl name

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

Code Examples

server

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

local 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)
else
-- 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("- "..ACLName, thePlayer)
end
end
end
addCommandHandler("listacls", printOutAllACLs)