"Sputnik" help  
Sputnik Help
NbtCompoundRemove(<nbtCompound>, <key> )

Description

Removes a key-value pair from an NBT compound based on the specified key.

Parameters

<nbtCompound> The NBT compound from which to remove the key-value pair.
<key> The key of the key-value pair to be removed from the NBT compound.

Return Value

Success: Returns true if the key-value pair is successfully removed from the NBT compound.
Failure: Returns false if there is an error during the removal operation or if the provided key does not exist in the NBT compound.

Remarks

The NbtCompoundRemove function allows you to remove a specific key-value pair from an NBT compound. It takes the NBT compound and the key as input parameters.

The function searches for the specified key in the NBT compound and removes the corresponding key-value pair if found. If the key is not found, the function returns false.

Related

Example

Example of usage:

my $nbt = NbtNew(@NbtCompound);
NbtCompoundSet($nbt, "Cat", "Meow");
NbtCompoundSet($nbt, "Dog", "Woof");

say $nbt;
foreach(my $k => my $v in $nbt)
    say $k . " -> " . $v;
    
NbtCompoundRemove($nbt, "Cat");

say $nbt;
foreach(my $k => my $v in $nbt)
    say $k . " -> " . $v;

// PRINTS
// {NBTTag;Compound::[Cat:Meow,Dog:Woof]}
// Cat -> Meow
// Dog -> Woof
// {NBTTag;Compound::[Dog:Woof]}
// Dog -> Woof

 


Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org