SPS:getProperties: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "This function is used to retrieve all property elements.")
 
No edit summary
Line 1: Line 1:
{{Server client function}}
<lowercasetitle></lowercasetitle>
__NOTOC__
This function is used to retrieve all property elements.
This function is used to retrieve all property elements.
==Syntax==
<syntaxhighlight lang="lua">
table getProperties()
</syntaxhighlight>
===Returns===
Returns all '''property''' elements.
==Example==
<section name="Serverside example" class="server" show="true">
This example script outputs all property IDs to the chat.
<syntaxhighlight lang="lua">
addEventHandler("onResourceStart",root,
function()
local properties = getProperties()
for i,property in ipairs(properties) do
outputChatBox("ID: "..getPropertyID(property))
end
end
)
</syntaxhighlight>
</section>

Revision as of 11:17, 7 June 2019


This function is used to retrieve all property elements.

Syntax

table getProperties()

Returns

Returns all property elements.

Example

Click to collapse [-]
Serverside example

This example script outputs all property IDs to the chat.

addEventHandler("onResourceStart",root,
	function()
		local properties = getProperties()
		for i,property in ipairs(properties) do
			outputChatBox("ID: "..getPropertyID(property))
		end
	end
)