Difference between revisions of "TryToClear - ReferenceAlias"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Plplecuyer
(Created page with "Category:Scripting Category:Papyrus '''Member of:''' ReferenceAlias Script Clears this alias and returns whether anything was in it to begin with. == Syntax == <sou...")
 
imported>Nitor
(→‎Examples: Corrected function (Clear -> TryToClear))
 
Line 19: Line 19:
<source lang="papyrus">
<source lang="papyrus">
; Clear the alias
; Clear the alias
if OptionalAlias.Clear()
if OptionalAlias.TryToClear()
   Debug.Trace("Removed something from the alias")
   Debug.Trace("Removed something from the alias")
else
else

Latest revision as of 04:14, 23 January 2021

Member of: ReferenceAlias Script

Clears this alias and returns whether anything was in it to begin with.

Syntax[edit | edit source]

bool Function TryToClear()

Parameters[edit | edit source]

None

Return Value[edit | edit source]

Whether the alias had a reference in it when it was cleared or not.

Examples[edit | edit source]

; Clear the alias
if OptionalAlias.TryToClear()
  Debug.Trace("Removed something from the alias")
else
  Debug.Trace("Didn't remove anything from the alias (already empty)")
endIf

See Also[edit | edit source]