userpurchasemanager - TogetherGames/Public-Corona-Lua GitHub Wiki

UserPurchaseManager

together.UserPurchaseManager

Overview

The UserPurchaseManager class contains a collection UserPurchases. With this class, a developer will be able to Create and Retrieve All their UserPurchases.


Members

table UserPurchases

Stores all the UserPurchases contained in the Manager.


Methods


Add()

Adds a UserPurchase to the internally managed list without persistence.

Note
This method is deprecated

Returns void
Syntax
UserPurchaseManager:Add( userPurchase )
Parameters

TogetherUserPurchase userPurchase

Instance of a UserPurchase to add internally

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

FindByUserPurchaseID()

Finds the UserPurchase with the specified UserPurchaseID if it exists, otherwise returns nil

Syntax
UserPurchaseManager:FindByUserPurchaseID( userPurchaseID )
Parameters

number userPurchaseID

The ID of the UserPurchase to find

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

GetCount()

Gets the number of UserPurchases currently managed internally.

Returns number
Syntax
UserPurchaseManager:GetCount(  )

Get()

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

Syntax
UserPurchaseManager:Get( index )
Parameters

number index

The index of the UserPurchase to find

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

IndexOf()

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

Returns number
Syntax
UserPurchaseManager:IndexOf( userItem )
Parameters

TogetherUserPurchase userItem

Instance of the UserPurchase to find the index of

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

IndexOfByUserPurchaseID()

Returns the index of the UserPurchase with the specified UserPurchaseID if it exists, otherwise returns -1.

Returns number
Syntax
UserPurchaseManager:IndexOfByUserPurchaseID( userPurchaseID )
Parameters

number userPurchaseID

The ID of the UserPurchase to find the index of

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

Remove()

Removes a UserPurchase from the internally managed list. This does not delete the purchase from the user's account persistently.

Note
This method is deprecated

Returns void
Syntax
UserPurchaseManager:Remove( index )
Parameters

number index

The index of the UserPurchase to remove internally

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

Create()

Creates a new UserPurchase record. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserPurchaseManager:Create( roomID, achievementID, itemID, description, count, userPurchaseProperties, callbackFunc )
Parameters

number roomID

The ID of the room where the purchase occurred. Pass in 0 for no room.

[number](#) achievementID

The ID of the achievement that was purchase.

[number](#) itemID

The ID of the item that was purchased.

[string](#) description

A textual description of the purchase.

[number](#) count

the Number of (Achievements, Items, things) purchased.

[PropertyCollection](./propertycollection) userPurchaseProperties

The properties to assign to the UserPurchase record. Pass an instance to link properties. Pass nil to assign no properties.

[function](#) callbackFunc

The function to call upon completion.

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

GetAll()

Gets all UserPurchases done by a User. Upon success, this will automatically update the internal list.

Returns void
Syntax
UserPurchaseManager:GetAll( callbackFunc )
Parameters

function callbackFunc

The function to call upon completion.

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