Skip to main content
Adds a metadata template from an external script. A metadata template is a function that generates a metadata value every time an item that uses it is added to an inventory (a serial number, the owner’s name, a random stat, etc.). Templates registered this way work exactly like the ones in metadata_templates.lua: they appear in the item editor of the /inventory admin menu, where you can assign them to any item. See the Metadata guide for how templates are assigned to items.
Templates are kept in memory only. They are removed when your script stops and lost when jaksam_inventory restarts, so register them every time your script starts.

Parameters

Callback parameters

Return value

None

Notes

  • Server side only, as metadata is always generated by the server
  • If your template ID is the same as one in metadata_templates.lua, yours replaces it while your script is running, and the original one comes back when your script stops
  • While a template is not registered (your script hasn’t started yet, or has stopped), items using it are still added normally, only without that metadata field, and the server console shows a warning