AclListRights: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server function}}
{{Server function}}
{{Needs Example}}
This function returns a table of all the rights that a given ACL has.
This function returns a table of all the rights that a given ACL has.


Line 16: Line 15:


==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
This example outputs the rights of the given acl.
This example does...
<syntaxhighlight lang="lua">addCommandHandler("aclRights",function(player,command,theAcl)
<!-- 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(theAcl~="")then
<syntaxhighlight lang="lua">
rights = aclListRights(aclGet(tostring(theAcl)))
--TODO
count = 0
for acl,list in ipairs(#rights)do
outputChatBox("ACL List: "..theAcl.." #"..count.." Right: "..list..".",player)
count = count + 1
end
else
outputChatBox("Please type in a acl that you want to retrieve the rights from.",player)
outputChatBox("Please use this Syntax: /aclRights theACL ",player)
end
end)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 04:23, 27 April 2012

This function returns a table of all the rights that a given ACL has.

Syntax

table aclListRights ( acl theACL )

Required Arguments

  • theACL: The ACL to get the rights from

Returns

Returns a table over the rights as strings in the given ACL. This table might be empty. Returns false or nil if theACL is invalid or it fails for some other reason.

Example

This example outputs the rights of the given acl.

addCommandHandler("aclRights",function(player,command,theAcl)
	if(theAcl~="")then
		rights = aclListRights(aclGet(tostring(theAcl)))
		count = 0
		for acl,list in ipairs(#rights)do
			outputChatBox("ACL List: "..theAcl.." #"..count.." Right: "..list..".",player)
			count = count + 1
		end
	else
		outputChatBox("Please type in a acl that you want to retrieve the rights from.",player)
		outputChatBox("Please use this Syntax: /aclRights theACL ",player)
	end
end)

See Also