Function: SetTarget(spawn, target)
Description: Sets the selected target of a Spawn. Pass nil or omit the target to clear the selection. Player sources follow the engine's visibility rules.
Parameters:
spawn(Spawn) - Actor whose selected target is changed.target(Spawn or nil, optional) - Actor to select; nil or an omitted argument clears the selection.
Returns: None.
Selection identity and lifetime: The relationship stores a weak reference to the supplied actor allocation, rather than only its runtime ID. It does not keep the actor or zone alive. Later GetTarget calls cannot follow another allocation with a reused ID or address. Replacing or clearing the target publishes the normal Info update. Lua globals holding userdata also remain weak between protected callbacks. See Lua actor lifetime.