Skip to main content

Deleting

The delete keyword is used to either delete a value from a collection or entity, or to call a delete fn.

Deleting an element from a map

Use the delete keyword to remove a key-value pair from a map. The deleted value is returned.

let map = { a = 123, b = 456 }
let x = delete map.a // set x to 123 and remove the key-value pair from map

Deleting a value from an entity

Use the delete keyword to remove a value from an entity. The deleted value is returned.

pub prop this.Health

pub fn Example() {
Spawn this {
Health = 100
delete Health
}
}

Calling a delete function

delete fn this.Healthbar() {
// ...
}
fn this.Example() {
delete Healthbar
}