Deletearray

From Hercules Wiki
Jump to: navigation, search

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.

Important: 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;

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;

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