"Sputnik" help  
Sputnik Help
NbtCompoundReadFile(<file>, [<compressed>])

Description

Reads an NBT compound from a file.

Parameters

<file> The path to the file from which to read the NBT compound.
<compessed> Optional. If set to true, the file is treated as compressed GZip data. Defaults to false.

Return Value

Success: Returns the NBT compound read from the file.
Failure: Returns null if there is an error during the read operation or if the file does not contain a valid NBT compound.

Remarks

The NbtCompoundReadFile function allows you to read an NBT compound from a file. It takes the file path as input and an optional parameter to indicate whether the file is compressed GZip data.

If the [<compressed>] parameter is set to true, the function treats the file as compressed GZip data and performs the necessary decompression before reading the NBT compound. If it is not provided or set to false, the function assumes the file contains the NBT compound without compression.

Related

Example

Example of usage:

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

my $file = FileCreateTemp();
NbtCompoundWriteFile($nbt, $file);

my $nbtRead = NbtCompoundReadFile($file);
say $nbtRead;
foreach(my $k => my $v in $nbtRead)
    say $k . " -> " . $v;
    
FileDelete($file);

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

 


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