Skip to content

deletearray()

Warning

This page may contain outdated information, incompatible with the current version of Hercules and its coding standards.

Syntax

deletearray(<array>, <amount of elements to delete>);

Description

This command deletes a range of values within given array and shifts remaining values to fill the deletion gap.

Bug

Currently (r14395) the command uses getarraysize() internally, which leads to unpredictable results with arrays, that contain empty elements. It is recommended to use a combination of copyarray() and cleararray() instead.

Examples

deletearray(@array, 10);

Info

Deletes the first 10 elements of the array and shifts all other values by one to the left.

copyarray(@array[0], @array[10], 90);
cleararray(@array[90], 0, 10);

Info

Assuming @array has 100 elements, this achieves the same effect as the example above, but works properly even if @array has empty element(s).