GetElementID: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
This function gets the ID of an element. This is the element value of the item 'id', it's differnt to model IDs, weapons IDs and so on.
This function gets the ID of an element. This is the element value of the item 'id', but NOT like a model ID, weapons ID or simliar.


==Syntax==  
==Syntax==  
Line 11: Line 11:


===Returns===
===Returns===
This returns a ''string'' containing the element ID. It will return an empty ''string'' if it has no ID. It will return false if the element is invalid.
This returns a ''string'' containing the element ID. It will return an empty ''string'' if it has no ID. It will return ''false'' if the element is invalid.


==Example==  
==Example==  

Revision as of 13:44, 29 July 2007

This function gets the ID of an element. This is the element value of the item 'id', but NOT like a model ID, weapons ID or simliar.

Syntax

string getElementID ( element theElement ) 

Required Arguments

  • theElement: the element from which to retrive the ID.

Returns

This returns a string containing the element ID. It will return an empty string if it has no ID. It will return false if the element is invalid.

Example

To get the ID of the following element:

<flag id="northflag" posX="2365" posY="215" posZ="32">

You could use the following code:

-- assume flag refers to the flag element in the above XML code
idstring = getElementID ( flag ) -- get the id of the flag element
outputChatBox ( "The flag's ID is: " .. idstring ) -- output: The flag's ID is: northflag

See Also