AclGroupListACL: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}<!-- Change this to "Client function" or "Server function" appropriately-->
{{Server function}}<!-- Change this to "Client function" or "Server function" appropriately-->
{{Needs Example}}
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
This function returns a table over all the ACL's that exist in a given ACL group.
This function returns a table over all the ACL's that exist in a given ACL group.
Line 8: Line 7:
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
table of acl aclGroupListACL ( aclgroup theGroup )
table aclGroupListACL ( aclgroup theGroup )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[aclgroup]]:listACL|aclList|}}
===Required Arguments===  
===Required Arguments===  
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
Line 17: Line 16:
===Returns===
===Returns===
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
Returns a table over the ACL elements in the given ACL group. This table might be empty. Returns ''false'' or ''nil'' if theGroup is invalid or it fails for some other reason.
Returns a table of the ACL elements in the given ACL group. This table might be empty. Returns ''false'' or ''nil'' if theGroup is invalid or it fails for some other reason.


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example outputs the list of ACL's if the aclGroup name is given. (TESTED!)
This example does...
<syntaxhighlight lang="lua">addCommandHandler("aclList",function(player,command,aclGroup)
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
if(aclGroup~="")then
<syntaxhighlight lang="lua">
tables = aclGroupListACL(aclGetGroup(aclGroup))
--TODO
count = 0
for list,nam in pairs(tables) do
outputChatBox("ACL LIST: "..aclGroup.."Line: "..tostring(count).." ACL: "..aclGetName(nam)..".",player)
count = count + 1
end
else
outputChatBox("Please add the aclGroup you want the list of.",player)
outputChatBox("Syntax: /aclList aclGroup",player)
end
end)
</syntaxhighlight>
</syntaxhighlight>


Line 30: Line 38:
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{ACL_functions}}
{{ACL_functions}}
[[zh-cn:AclGroupListACL]]

Latest revision as of 08:35, 5 February 2021

This function returns a table over all the ACL's that exist in a given ACL group.

Syntax

table aclGroupListACL ( aclgroup theGroup )

OOP Syntax Help! I don't understand this!

Method: aclgroup:listACL(...)
Variable: .aclList


Required Arguments

  • theGroup: The ACL group to get the ACL elements from

Returns

Returns a table of the ACL elements in the given ACL group. This table might be empty. Returns false or nil if theGroup is invalid or it fails for some other reason.

Example

This example outputs the list of ACL's if the aclGroup name is given. (TESTED!)

addCommandHandler("aclList",function(player,command,aclGroup)
	if(aclGroup~="")then
		tables = aclGroupListACL(aclGetGroup(aclGroup))
		count = 0
		for list,nam in pairs(tables) do
			outputChatBox("ACL LIST: "..aclGroup.."Line: "..tostring(count).." ACL: "..aclGetName(nam)..".",player)
			count = count + 1
		end
	else
		outputChatBox("Please add the aclGroup you want the list of.",player)
		outputChatBox("Syntax: /aclList aclGroup",player)
	end
end)

See Also