GetElementByID: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{Needs_Checking|See topic: http://forum.mtavc.com/viewtopic.php?t=17891}}
__NOTOC__  
__NOTOC__  
This function returns an element from the specified ID.
This function returns an element from the specified ID.

Revision as of 10:44, 6 October 2006

Dialog-information.png This article needs checking.

Reason(s): {{{1}}}


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