Difference between revisions of "TryToClear - ReferenceAlias"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
(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>Thingy Person
 
Line 8: Line 8:
<source lang="papyrus">
<source lang="papyrus">
bool Function TryToClear()
bool Function TryToClear()
if (GetReference())
Clear()
return True
endif
return False
EndFunction
</source>
</source>



Latest revision as of 16:29, 29 June 2013

Member of: ReferenceAlias Script

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

Syntax[edit | edit source]

bool Function TryToClear()
	if (GetReference())
		Clear()
		return True
	endif
	return False
EndFunction

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.Clear()
  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]