The IMP Documentation Format is recommended for maintaining well-documented functions.
The following recommendations apply when using storage for temporary/transient data:
- The storage name should have a 1:1 correlation to the function name.
- Example:
storage mypack:utils/get_full_name
- This helps to avoid ambiguity and makes it clear where each storage is being created.
- It also helps to avoid one function from accidentally accessing the data of another.
- Example:
- Use a separate namespace ending in
.__temp__
for all transient storage.- Example:
storage mypack.__temp__:utils/get_full_name
- Example:
- Due to the limitations of selecting root NBT paths, it is also recommended to use separate transient root tags for input vs output data.
There are several standard atomic tag types defined. These all match their NBT equivalent:
byte
short
int
long
float
double
string
There are some other names for commonly-used patterns:
bool
is anint
that's eithertrue
(1b
) orfalse
(0b
)RawTextComponent
is a raw JSON text componentstring
Command
is a commandstring
Anything ending in []
is an array:
int[]
is an array ofint
sCommand[]
is an array of commandstring
s
There is currently no standard format for specifying nested types via compound tags, however it is recommended to give them unique, identifiable names. For example, the Module
compound is a common data structure used in IMP to record information about a datapack module.
Transient storage includes anything involving argument passing, return values, and intermediate calculations, that need only be preserved in the current scope or tick.
Using a separate namespace for this type of storage allows us to separate important, persistent data from everything else. It also allows us to safely purge or delete any storage files following this naming scheme.
The recommended standard for naming transient storage is by appending .__temp__
to the namespace of the storage. For example, the namespace imp.__temp__
is used for all of IMP's argument passing, return values, and intermediate calculation storage.
Transient root tags are used primarily to work-around certain limitations with selecting root NBT paths. However, they also double as an obvious visual indicator for common patterns when using storage.
These are the recommended standard root tag names for transient data:
__input__
for supplying arguments, such as with@input
.__output__
for returning values, such as with@output
.__temp__
for intermediate calculations involving NBT, such as resolving strings and iterating over NBT lists.