"Sputnik" help  
Sputnik Help
NbtCompoundWriteFile(<nbtCompound>, <file>, [<compress>])

Description

Writes an NBT compound to a file.

Parameters

<nbtCompound> The NBT compound to write to the file.
<file> The path to the file where the NBT compound will be written.
<compress> Optional. If set to true, the NBT compound will be compressed using GZip before writing to the file. Defaults to false.

Return Value

Success: Returns true if the NBT compound is written to the file successfully.
Failure: Returns false if there is an error during the write operation.

Remarks

The NbtCompoundWriteFile function allows you to write an NBT compound to a file. It takes the NBT compound, the file path, and an optional parameter to indicate whether the compound should be compressed using GZip before writing.

If the <compress> parameter is set to true, the NBT compound will be compressed using GZip before writing to the file. If it is not provided or set to false, the compound will be written as-is 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