GetElementByID: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:


__NOTOC__  
__NOTOC__  
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function returns an element from the specified ID.


==Syntax==  
==Syntax==  
Line 10: Line 10:


===Required Arguments===  
===Required Arguments===  
*'''id:''' The ID of the element as it appears in the xml file.
*'''id:''' The ID of the element as it appears in the XML file.


===Returns===
===Returns===
Line 16: Line 16:


==Example==  
==Example==  
This example finds
This example assigns the 'team1' element to redTeam after finding the element based on it's ID.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- Assuming an element with the id 'offense' exists (i.e. <team1 id="offense">), get it's element
-- Assuming an element with the id "red" exists (i.e. <team1 id="red">), get it's element
offenseElement = getElementByID ( "offense" )
redTeam = getElementByID ( "red" )
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{FunctionArea_Functions}}

Revision as of 11:07, 2 June 2006


This function returns an element from the specified ID.

Syntax

element getElementByID ( string id )  

Required Arguments

  • id: The ID of the element as it appears in the XML file.

Returns

Returns the element with the given ID, or false if no such element exists.

Example

This example assigns the 'team1' element to redTeam after finding the element based on it's ID.

-- Assuming an element with the id "red" exists (i.e. <team1 id="red">), get it's element
redTeam = getElementByID ( "red" )

See Also

Template:FunctionArea Functions