UserFunction; SobGroup_Clone - HWRM/KarosGraveyard Wiki

Original URL: https://github.com/HWRM/KarosGraveyard/wiki/UserFunction;-SobGroup_Clone

SobGroup_Clone(original_group, new_group_name)

By Novaras (Fear)

Requires

Description

Creates and clears a new SobGroup named by new_group_name, if provided (using SobGroup_Fresh). Otherwise, it will be named the same as original_group, but with "-clone" appended.

This new group contains all the members of the original group.

Example

-- string "cloned-group" is returned, and that SobGroup contains all the ships of "original-group"
SobGroup_Clone("original-group", "cloned-group");

-- string "original-group-clone" is returned by default
SobGroup_Clone("original-group");

Definition

We could make use of SobGroup_Copy, however for a fresh group it is equivalent to SobGroup_SobGroupAdd. 🤷‍♂️

--- Creates a new SobGroup, named with `new_name`, or '<original-name>-clone', if a new name is not provided for the group.
[email protected] original string
[email protected] new_name string
[email protected] string
function SobGroup_Clone(original, new_name)
	new_name = new_name or (original .. "-clone");
	SobGroup_Fresh(new_name);
	SobGroup_SobGroupAdd(new_name, original);
	return new_name;
end

Arguments

Param Type Description
sSourceGroup string The original SobGroup's name.
sOutputGroup string The new, cloned group

Returns

Type Description
string The name of the new SobGroup (as passed in). If no name was passed, is the name of original group with "-copy" appeneded.

Related Pages

Comments

Page Status

Updated Formatting? Initial
Updated for HWRM? Initial