itemmanager - TogetherGames/Public-Corona-Lua GitHub Wiki

ItemManager

together.ItemManager

Overview

The ItemManager is used for fetching and finding items that exist for the current game.


Members

table Items

Stores all the Items contained in the Manager.


Methods


Add()

Adds an Item to the manager internally without persistence.

Note
This method is deprecated

Returns void
Syntax
ItemManager:Add( item )
Parameters

TogetherItem item

Instance of an Item to add internally

--------------------------------------------------------------------------------

FindByItemID()

Finds the Item with the specified ItemID if it exists, otherwise returns nil.

Returns TogetherItem
Syntax
ItemManager:FindByItemID( itemID )
Parameters

number itemID

The ID of the Item to find

--------------------------------------------------------------------------------

GetCount()

Gets the number of Items currently managed internally.

Returns number
Syntax
ItemManager:GetCount(  )

Get()

Gets the Item at the specified index if it exists, otherwise returns nil.

Returns TogetherItem
Syntax
ItemManager:Get( index )
Parameters

number index

The index of the Item to find

--------------------------------------------------------------------------------

IndexOf()

Returns the index of the specified Item if it exists, otherwise returns nil.

Returns number
Syntax
ItemManager:IndexOf( item )
Parameters

TogetherItem item

Instance of the Item to find the index of

--------------------------------------------------------------------------------

IndexOfByItemID()

Returns the index of the Item with the specified ItemID if it exists, otherwise returns -1.

Returns number
Syntax
ItemManager:IndexOfByItemID( itemID )
Parameters

number itemID

The ID of the Item to find the index of

--------------------------------------------------------------------------------

Remove()

Removes an Item from the internally managed list. This does not delete the Item from the game persistently.

Note
This method is deprecated

Returns void
Syntax
ItemManager:Remove( index )
Parameters

number index

The index of the Item to be removed

--------------------------------------------------------------------------------

GetAll()

Gets all Items configured in the Game. Upon success, this will automatically update the internal list.

Returns void
Syntax
ItemManager:GetAll( callbackFunc )
Parameters

function callbackFunc

The function to call upon completion.

--------------------------------------------------------------------------------
⚠️ **GitHub.com Fallback** ⚠️