AclGroupList: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 13: Line 13:
==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
<!-- Explain what the example is in a single sentance -->
This example does...
This example shows, how to output all ACL Group Names by ''showAclGroups''
<!-- 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 -->
<!-- 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 -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--TODO
function showGroups(player)
local groups = {}
groups = aclGroupList()
for i,v in ipairs(groups) do
local name = aclGroupGetName(v)
outputChatBox(tostring(name),player)
end
end
addCommandHandler("showAclGroups",showGroups)
</syntaxhighlight>
</syntaxhighlight>



Revision as of 09:00, 6 September 2011

This function returns a table of all the ACL groups.

Syntax

table aclGroupList ()

Returns

Returns a table of all the ACL groups if successful, returns an empty table if no ACL groups exist. false/nil can be returned if this function fails for some other reason.

Example

This example shows, how to output all ACL Group Names by showAclGroups

function showGroups(player)
	local groups = {}
	groups = aclGroupList()
	for i,v in ipairs(groups) do
		local name = aclGroupGetName(v)
		outputChatBox(tostring(name),player)
	end
end
addCommandHandler("showAclGroups",showGroups)

See Also