"Sputnik" help  
Sputnik Help
NbtCompoundSet(<nbtCompound>, <name>, <value>)

Description

Sets a value in an NBT compound with the specified name.

Parameters

<nbtCompound> The NBT compound in which to set the value.
<name> The name of the key for the value in the NBT compound.
<value> The value to be stored in the NBT compound.

Return Value

Success: Returns true if the value is successfully set in the NBT compound.
Failure: Returns false if there is an error during the set operation or if the provided NBT compound is invalid.

Remarks

The NbtCompoundSet function allows you to set a value in an NBT compound with the specified name. The function takes the NBT compound, the name of the key, and the value to be stored.

The <name> parameter represents the name of the key under which the value will be stored in the NBT compound. It can be null or blank if desired.

The <value> parameter is a Sputnik variable, not an NBT tag. The function automatically converts the Sputnik variable into the appropriate NBT tag based on its type before storing it in the compound.

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;

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

 


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