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
nbtStorage NBT No 0.7r


Functions

read

read() -> table

Returns the NBT data stored in the block.


writeJson

writeJson(json: string) -> boolean | nil, string

Writes the json as NBT data into the block and returns true if the json is valid and the data is successfully written. Otherwise it returns nil and an error message.


writeTable

writeTable(nbt: 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.

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

storage.writeTable({
    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.