AclGroupListObjects: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (→‎Syntax: OOP)
m (fix oop syntax)
Line 8: Line 8:
<!-- 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 string aclGroupListObjects ( aclgroup theGroup )
table aclGroupListObjects ( aclgroup theGroup )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP|This function is also a static function underneath the ACL Group class.|[[aclgroup]]:listObjects|objects|}}
{{OOP||[[aclgroup]]:listObjects|objects|}}
===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 17:
===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 objects 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 strings 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==  

Revision as of 14:49, 1 January 2015

This function returns a table over all the objects that exist in a given ACL group. These are objects like players and resources.

Syntax

table aclGroupListObjects ( aclgroup theGroup )

OOP Syntax Help! I don't understand this!

Method: aclgroup:listObjects(...)
Variable: .objects


Required Arguments

  • theGroup: The ACL group to get the objects from

Returns

Returns a table of strings 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 a list of Objects if the ACL Group is given. (TESTED!)

addCommandHandler("aclObjectList",function(player,command,aclGroup)
	if(aclGroup~="")then
		table = aclGroupListObjects(aclGetGroup(aclGroup))
		count = 0
		for objects,name in pairs(table)do
			outputChatBox("ACL LIST: "..aclGroup.." #"..tostring(count).." Object: "..name..".",player)
			count = count + 1
		end
	else
		outputChatBox("Please add the aclGroup you want the list of.",player)
		outputChatBox("Syntax: /aclObjectList aclGroup",player)
	end
end)

See Also