User Tools

Site Tools


modding:function:objenumitems

Discuss this page on this pages TalkPage

objEnumItems

See objEnumItems at Xelerus

Syntax (objEnumItems obj criteria itemVar exp) → value of last expression
Arguments obj: The spaceObject whose items will be enumerated over.
criteria: The criteria of the items you want from the spaceObject.
itemVar: Name of the variable that will be used to hold the current item of the enumeration.
exp: The expression you want to evaluate for each item on the spaceObject matching the criteria. The item will be available inside the expression under the name you used in 'itemVar'.
Returns What the last expression in the iteration returns. In general the return value of an enumeration is not really interesting.
Category item, iteration, spaceobject
Description Allows you to run some code on every item on an object, one at a time. You can limit which items to enumerate over by using item criteria. Iterates through the items in the space object that match the criteria. The variable will be available inside the function, holding the current item for each iteration.

Example

(objEnumItems gPlayerShip "*wI" instWeap
  (dbgOutput (itmGetName instWeap 0))
)

Outputs the name of all the installed weapons of the players ship to the debug console. Return to Functions list

modding/function/objenumitems.txt · Last modified: 2014/12/27 04:40 by 127.0.0.1