"Sputnik" help  
Sputnik Help
Nbt(<value>, [<name>])

Description

Creates an NBT (Named Binary Tag) object with the specified value and optional name. The Nbt function automatically determines the appropriate NBT type for the given value and creates the corresponding NBT object.

Parameters

<value> The value to be assigned to the NBT object. The data type of the value determines the NBT type of the object.
<name> Optional name of the NBT object. If not provided, the resulting NBT object will have an empty name.

Return Value

Success: Returns an NBT object with the specified name and value.
Failure: Returns null.

Remarks

The <value> parameter represents the value to be assigned to the NBT object. The data type of the value determines the NBT type of the object. The function automatically detects the data type and creates the corresponding NBT object.

The resulting NBT object will have the specified value and optional name, with the appropriate NBT type assigned based on the data type of the value.

Please note that Sputnik's NBT system is not compatible with the Minecraft NBT system. Although Sputnik's NBT system is based on the Minecraft NBT system and shares some similarities, it is designed specifically for Sputnik and may not be directly interchangeable with Minecraft's NBT data.

Sputnik's NBT system was implemented to provide easy handling of binary data for saving and loading purposes, offering a convenient and efficient way to work with structured data. It is a separate and independent implementation, tailored to suit the needs of Sputnik and its programming environment.

While Sputnik's NBT system is capable and offers useful functionality, it is important to be aware of the distinctions between Sputnik's NBT system and the Minecraft NBT system. If you intend to use NBT data across both systems, it is recommended to account for the differences and implement any necessary conversions or adaptations to ensure compatibility.

Related

NbtNew

Example

Example of usage:

printr Nbt("Hello World");
printr Nbt(777);
printr Nbt(42.77);
printr Nbt(array(10, 20));
printr Nbt(bin("hello"));

say NbtToVar(Nbt("Hello World"));

// PRINTS
// {obj;UNbtTagString}
// {obj;UNbtTagLong}
// {obj;UNbtTagDouble}
// {obj;UNbtTagLongArray}
// {obj;UNbtTagByteArray}

Simple data extraction:

my $nbt = Nbt("Hello World");
say NbtToVar($nbt);

// PRINTS
// Hello World

 


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