π¦ Remove from list
π¦ Remove from list
The Delete from list block allows you to remove a specific element from a List (Array) type variable. It is essential for managing inventories, shopping carts, task lists or groups of dynamic entities.
This block is particularly useful for reflecting actions like consuming an item, removing a completed mission, or disappearing a defeated enemy.
π₯ Entries
- list (List/Array): The collection of data from which an element must be deleted.
- index_or_value (Number/Text/Variable): The position (index) or the exact value of the element to remove from the list.
π€ Outings
- Stream: An instantaneous signal confirming the deletion of the element, allowing updates to be triggered or the logical flow to continue.
π‘ Example of use
Scenario: Remove a defeated enemy from a target list
- The player faces a group of enemies represented by the Active_Enemies List variable: ["Goblin", "Orc", "Troll"].
- After defeating the Orc, the system identifies its position in the list (index 1).
- The Delete from list block is called with:
- list = Active_Enemies
- index_or_value = 1 (Orc index)
- The list is instantly updated to ["Goblin", "Troll"].
- The exit flow triggers a victory animation and updates the player interface.
βοΈ Technical Details
- Duplicate management: To delete a specific element among duplicates, choose the index rather than the value.
- Robustness: A deletion attempt with a non-existent index (greater than the size of the list) will be ignored without generating an error.
- Performance: The operation is executed in constant time (O(1)) for deletion by index, and in linear time (O(n)) for deletion by value.
Updated on: 04/03/2026
Thank you!
