UserFunction; SobGroup_Clone - HWRM/KarosGraveyard GitHub Wiki
SobGroup_Clone(<original_group>, <new_group_name>)
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
--- Creates a new SobGroup, named with `new_name`, or '<original-name>-clone', if a new name is not provided for the group.
---@param original string
---@param new_name? string
---@return 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 |
---|---|---|
original_group |
string |
The original SobGroup's name. |
new_group_name |
string |
The name of 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. |