Zig: SNBT values¶
nbt.zig: SNBT parsing and writing for Zig mods, with the rules of the Rust and Go bindings: a bare number is an int, then a long, then a double; a suffix b, s, l, f or d fixes the type; true and false are bytes; any other bare word is a string.
Functions¶
nbt.parse¶
| Zig | |
|---|---|
Parses SNBT. Every node is allocated with arena, which the caller frees as a whole; a bare string or key may also point into text, which must outlive the result.
- Parameters:
- arena :
std.mem.Allocator - text :
[]const u8
- arena :
- Return type:
ParseError!Value
Declarations¶
nbt.max_depth¶
| Zig | |
|---|---|
The deepest nesting accepted, the cap Minecraft puts on NBT. A deeper payload is refused instead of exhausting the stack of a host thread.
nbt.Value¶
| Zig | |
|---|---|
One SNBT value. Typed arrays hold their numbers as i64 whatever the element width.
nbt.Value.get¶
| Zig | |
|---|---|
Follows a dotted path through compounds; null when a step is missing.
- Parameters:
- path :
[]const u8
- path :
- Return type:
?Value
nbt.Value.getString¶
| Zig | |
|---|---|
The string at path, or null when it is absent or not a string.
- Parameters:
- path :
[]const u8
- path :
- Return type:
?[]const u8
nbt.Value.getInt¶
| Zig | |
|---|---|
The integer at path of any width, or null when it is absent or not one.
- Parameters:
- path :
[]const u8
- path :
- Return type:
?i64
nbt.Value.getFloat¶
| Zig | |
|---|---|
The number at path, integer or floating, or null when it is absent.
- Parameters:
- path :
[]const u8
- path :
- Return type:
?f64
nbt.Value.getBool¶
| Zig | |
|---|---|
The byte at path read as a boolean, or null when it is absent or not 0 or 1.
- Parameters:
- path :
[]const u8
- path :
- Return type:
?bool
nbt.Entry¶
One key of a compound and its value.
nbt.ParseError¶
| Zig | |
|---|---|