useritemmanager - TogetherGames/Public-Corona-Lua GitHub Wiki
together.UserItemManager
The UserItemManager is used for fetching and finding items that exist for the current user.
table UserItems
Stores all the UserItems contained in the Manager.
Adds a UserItem to the internally managed list without persistence.
Note
This method is deprecated
Returns void
UserItemManager:Add( userItem )
TogetherUserItem userItem
Instance of a UserItem to add internally
--------------------------------------------------------------------------------Finds the UserItem with the specified UserItemID if it exists, otherwise returns nil.
Returns TogetherUserItem
UserItemManager:FindByUserItemID( userItemID )
number userItemID
The ID of the UserItem to find
--------------------------------------------------------------------------------Gets the number of UserItems currently managed internally.
Returns number
UserItemManager:GetCount( )
Gets the UserItem at the specified index if it exists, otherwise returns nil.
Returns TogetherUserItem
UserItemManager:Get( index )
number index
The index of the UserItem to retrieve.
--------------------------------------------------------------------------------Returns the index of the specified UserItem if it exists, otherwise returns nil.
Returns number
UserItemManager:IndexOf( userItem )
TogetherUserItem userItem
Instance of the UserItem to find the index of
--------------------------------------------------------------------------------Returns the index of the UserItem with the specified UserItemID if it exists, otherwise returns -1.
Returns number
UserItemManager:IndexOfByUserItemID( userItemID )
number userItemID
The ID of the UserItem to find the index of
--------------------------------------------------------------------------------Removes a UserItem from the internally managed list. This does not delete the user item from the user's account persistently.
Note
This method is deprecated
Returns void
UserItemManager:Remove( index )
number index
The index of the UserItem to remove internally
--------------------------------------------------------------------------------Awards a UserItem. Upon success, this automatically updates the internal list.
Note
Rooms are deprecated and the roomID has no effect at this time
Returns void
UserItemManager:Award( itemID, roomID, userItemProperties, callbackFunc )
number itemID
The ID of the Item to award.
[number](#) roomIDThe ID of the Room the UserItem is being awarded in. Pass 0.
[PropertyCollection](./propertycollection) userItemPropertiesThe properties to assign to the UserItem. Pass nil to assign no properties.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Creates a UserItem.
Note
Rooms are deprecated and the roomID has no effect at this time
Returns void
UserItemManager:Create( itemID, roomID, userItemProperties, callbackFunc )
number itemID
The ID of the Item to create a UserItem from.
[number](#) roomIDThe ID of the Room the UserItem is being awarded in. Pass 0.
[PropertyCollection](./propertycollection) userItemPropertiesThe properties to assign to the UserItem. Pass nil to assign no properties.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Deletes a UserItem. Upon success, this automatically updates the internal list.
Returns void
UserItemManager:Delete( userItemID, callbackFunc )
number userItemID
The ID of the UserItem to delete.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Gets all UserItems assigned to the User. Upon success, this automatically updates the internal list.
Returns void
UserItemManager:GetAll( callbackFunc )
function callbackFunc
The function to call upon completion.
--------------------------------------------------------------------------------Purchases a UserItem. Upon success, this automatically updates the internal list.
Note
Rooms are deprecated and the roomID has no effect at this time
Returns void
UserItemManager:Purchase( itemID, roomID, userItemProperties, callbackFunc )
number itemID
The ID of the Item to purchase.
[number](#) roomIDThe ID of the Room the UserItem is being awarded in. Pass 0.
[PropertyCollection](./propertycollection) userItemPropertiesThe properties to assign to the UserItem. Pass nil to assign no properties.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------Sells a UserItem. Upon success, this automatically updates the internal list.
Returns void
UserItemManager:Sell( userItemID, callbackFunc )
number userItemID
The ID of the UserItem to sell.
[function](#) callbackFuncThe function to call upon completion.
--------------------------------------------------------------------------------