Item

A interactive, storable and extensible base for the inventory system.

Functions

Item:Get(key)

View source »

Returns a custom metadata value given the key.

Parameters

  • key string

    The key to search for. This must be a string.

Returns

  • any

    The value of the key.

Item:GetID()

View source »

Returns the item's unique ID.

Returns

  • number

    The item's unique ID.

Item:GetName()

View source »

Returns the name of the item, this can be overriden to return a custom name or a dynamic name.

Returns

  • string

    The name of the item.

Item:GetOwner()

View source »

Returns the owner of the item. This only works on the server because only the server manages this information, on the client we should always assume the owner is the local player.

Returns

  • Player

    The owner of the item.

Item:GiveFlag(flag)

View source »

Gives a given flag to the item.

Parameters

  • flag int

    The flag to give.

Item:HasFlag(flag)

View source »

Returns whether the item has a given flag.

Parameters

  • flag int

    The flag to check.

Returns

  • bool

    Whether the item has the flag.

Item:Set(key, value)

View source »

Sets a custom metadata value given the key.

Parameters

  • key string

    The key to set. This must be a string.

  • value

    The value to set the key to.

Item:TakeFlag(flag)

View source »

Takes a given flag from the item.

Parameters

  • flag int

    The flag to take.