GetElementData: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | |||
Elements can contain data values. These are accessable via names, and their value can be retrieved using [[getElementData]] and set using [[setElementData]]. These values are also loaded from the attributes in the XML map files, and as such can provide a powerful way to store and retrieve data in XML for each element. | Elements can contain data values. These are accessable via names, and their value can be retrieved using [[getElementData]] and set using [[setElementData]]. These values are also loaded from the attributes in the XML map files, and as such can provide a powerful way to store and retrieve data in XML for each element. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua">string getElementData ( element theElement, string name )</syntaxhighlight> | ||
===Required Arguments=== | |||
*'''theElement:''' This is the element with data you want to retreive. | |||
*'''name:''' The name of the element data entry you want to retrieve. | |||
===Returns=== | |||
This function returns a ''string'' containing the requested element data, or ''false'' if the element data does not exist, or the element itself does not exist. | |||
==Example== | ==Example== | ||
This example will | This example will store the version of the map in the variable ''mapVersion''. Generally this will be ''2.0'' in the final release. | ||
<syntaxhighlight lang="lua">map = getRootElement ( ) | <syntaxhighlight lang="lua"> | ||
mapVersion = getElementData ( map, "version" )</syntaxhighlight> | map = getRootElement ( ) | ||
mapVersion = getElementData ( map, "version" ) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Element functions}} | {{Element functions}} |
Revision as of 17:32, 21 August 2006
Elements can contain data values. These are accessable via names, and their value can be retrieved using getElementData and set using setElementData. These values are also loaded from the attributes in the XML map files, and as such can provide a powerful way to store and retrieve data in XML for each element.
Syntax
string getElementData ( element theElement, string name )
Required Arguments
- theElement: This is the element with data you want to retreive.
- name: The name of the element data entry you want to retrieve.
Returns
This function returns a string containing the requested element data, or false if the element data does not exist, or the element itself does not exist.
Example
This example will store the version of the map in the variable mapVersion. Generally this will be 2.0 in the final release.
map = getRootElement ( ) mapVersion = getElementData ( map, "version" )
See Also
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement