"Sputnik" help  
Sputnik Help
NbtListExTagCount(<nbtListEx>)

Description

Returns the number of tags in an NBT list.

Parameters

<nbtList> The NBT list for which to count the tags.

Return Value

Success: Returns an integer representing the number of tags in the NBT list.
Failure: Returns false.

Remarks

The NbtListTagCount function allows you to determine the number of tags in an NBT list. It returns the count as an integer value.

Related

Example

Example of usage:

my $nbt = NbtNew(@NbtListEx);
NbtListExAppendTag($nbt, Nbt("Hello"));
NbtListExAppendTag($nbt, Nbt("Cat"));

say $nbt;
say "TagCount = " . NbtListExTagCount($nbt);

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

// PRINTS
// {NBTTag;ListEx:2 entries}
// TagCount = 2
// [0] Hello
// [1] Cat

It is possible to loop through elements using a normal loop for example:

my $nbt = NbtNew(@NbtListEx);
NbtListExAppendTag($nbt, Nbt("Hello"));
NbtListExAppendTag($nbt, Nbt("Cat"));

say $nbt;
say "TagCount = " . NbtListExTagCount($nbt);

my $i = 0;
foreach(my $tag in $nbt)
    say "[{\$i++}] " . $tag;

// PRINTS
// {NBTTag;ListEx:2 entries}
// TagCount = 2
// [0] Hello
// [1] Cat

 


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