Opened 15 years ago

Closed 15 years ago

#924 closed Bug (Fixed)

_ArrayDelete removes last entry when element beyond Ubound is specified

Reported by: DaleHohm Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:


In the following example, _ArrayDelete is instructed to delete element 15 even though only elements 0-9 exist.

The call deletes the last element, 9, without error.

It would be nice if the function were reengineered to fail in a case like this (perhaps optionally), but minimally, the documentation should note this behaviour.

Possible wording: Warning: if $iElement references a position beyond the end of the array, the last array element will be deleted.

#include <Array.au3>

Local $avArray[10]

$avArray[0] = "JPM"
$avArray[1] = "Holger"
$avArray[2] = "Jon"
$avArray[3] = "Larry"
$avArray[4] = "Jeremy"
$avArray[5] = "Valik"
$avArray[6] = "Cyberslug"
$avArray[7] = "Nutster"
$avArray[8] = "JdeB"
$avArray[9] = "Tylo"

_ArrayDisplay($avArray, "$avArray BEFORE _ArrayDelete()")
_ArrayDelete($avArray, 15)
ConsoleWrite(@error & @CRLF)
_ArrayDisplay($avArray, "$avArray AFTER _ArrayDelete()")

Attachments (0)

Change History (1)

comment:1 Changed 15 years ago by Jpm

  • Milestone set to
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Jpm.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.