GetNthLinkedRef - ObjectReference

Revision as of 13:25, 30 October 2015 by imported>Plplecuyer
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Member of: ObjectReference Script

Gets the Nth linked ref from this object.

SyntaxEdit

ObjectReference Function GetNthLinkedRef(int aiLinkedRef, Keyword apKeyword = None) native

ParametersEdit

  • aiLinkedRef: The linked ref to get. 0 will return this object, 1 will return the same as GetLinkedRef with no keyword parameter, 2 will return essentially "GetLinkedRef().GetLinkedRef()", and so on.
  • apKeyword: The keyword chain to follow (see GetLinkedRef).
    • Default: None

Return ValueEdit

The Nth linked ref from this object.

ExamplesEdit

; Assume Item3 is the linked ref of Item2, which is the linked ref of Item1
ObjectReference linkedRef1 = Item1.GetNthLinkedRef(0) ; Returns Item1
ObjectReference linkedRef2 = Item1.GetNthLinkedRef(1) ; Returns Item2
ObjectReference linkedRef3 = Item1.GetNthLinkedRef(2) ; Returns Item3


; Assume Item3 is the linked ref of Item2, which is the linked ref of Item1, all through the special keyword
ObjectReference linkedRef1 = Item1.GetNthLinkedRef(0, SpecialKeyword) ; Returns Item1
ObjectReference linkedRef2 = Item1.GetNthLinkedRef(1, SpecialKeyword) ; Returns Item2
ObjectReference linkedRef3 = Item1.GetNthLinkedRef(2, SpecialKeyword) ; Returns Item3

NotesEdit

If you are operating on multiple linked refs in a chain it is generally faster to use GetLinkedRefChain and use the resulting array directly.

See AlsoEdit