Skip to content

NBT Storage

Picture

!Image of the NBT Storage block

NBT Storage is a custom block that allows reading and writing of NBT data to the block for later use.


| Peripheral Name | Interfaces with | Has events | Introduced in | | --------------- | --------------- | ---------- | ------------- | | nbt_storage | NBT | No | 0.7r |

Functions

load

load() -> table

Returns the NBT data stored in the block.


save

save(data: string | table) -> boolean | nil, string

Writes NBT data into the block and returns true if the data is successfully written. Otherwise it returns nil and an error message.
If the data is a string, it will be parsed as SNBT format.

1
2
3
4
5
6
7
8
9
local storage = peripheral.find("nbt_storage")

storage.save({
    specialString = "A super special string"
})

local nbt = storage.read()
-- prints "A super special string"
print(nbt.specialString)

Changelog/Trivia

0.7r
Added NBT Storage block.

Comments