Objects Inventory - brianhang/nutscript2 GitHub Wiki

Description

The inventory is a container for Item objects. Inventories belong to Character objects. By default, NutScript does not provide an implementation for the inventory object so one must by provided by you. So, inventories can vary except for the fact that it needs to implement the functions listed below.

Fields

The fields for this object is dependent on the implementation being used.

Functions

Name Description
Inventory:add Adds an item to the inventory.
Inventory:delete Deletes an inventory from existence.
Inventory:getOwner Returns the ID of the character that owns this inventory.
Inventory:load Loads the items that belongs to the inventory.
Inventory:remove Removes an item to the inventory.
Inventory:save Saves all the items in the inventory.
Inventory:sync Synchronizes which items the inventory contains to client(s).

Notes

  • The default implementation makes the Inventory seem more of an interface since functions that not have been overwritten will error.