Product Site

5.3.13.9. delete

Returns and deletes the member item with the specified index from the queue. If there is no item with the specified index, .nil is returned and no item is deleted. All elements following the deleted item will be moved up in the queue ordering and the item indexes will be adjusted for the deletion. The size of the queue will be reduced by one element. The delete method and the remove method produce the same result for the queue class.
Example 5.203. Queue class — delete method
   a = .queue~of("Fred", "Mike", "Rick", "David")
   a~delete(2)  -- removes "Mike", resulting in the queue
                -- ("Fred", "Rick", "David")