"Sputnik" help  
Sputnik Help
NbtListExInsertTag(<nbtListEx>, <nbt>, <index>)

Description

Inserts an NBT tag into the specified index of an NBT list.

Parameters

<nbtList> The NBT list into which the NBT tag will be inserted.
<nbt> The NBT tag to be inserted into the NBT list.
<index> The index at which the NBT tag will be inserted.

Return Value

Success: Returns true if the NBT tag was successfully inserted into the NBT list.
Failure: Returns false if the provided nbtList parameter is not a valid NBT list or if the index is out of range.

Remarks

The NbtListInsertTag function allows you to insert an NBT tag into a specific index of an existing NBT list. The function verifies that the nbt parameter is of the appropriate type to be inserted into the list.

Related

NbtListExAppendTag

Example

Example of usage:

my $nbt = NbtNew(@NbtListEx);
NbtListExAppendTag($nbt, Nbt("Hello"));
NbtListExAppendTag($nbt, Nbt("Cat"));
NbtListExAppendTag($nbt, Nbt("Dog"));
NbtListExInsertTag($nbt, Nbt("Kitten"), 0);
NbtListExInsertTag($nbt, Nbt("Dolphin"), 1);

say $nbt;

for (my $i = 0; $i < NbtListExTagCount($nbt); $i++)
    say "[$i] " . NbtListExGetAt($nbt, $i);

// PRINTS
// {NBTTag;ListEx:5 entries}
// [0] Kitten
// [1] Dolphin
// [2] Hello
// [3] Cat
// [4] Dog

 


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