playerPolicyInfoUtil
A very simple utility module for retrieving a player's policy info safely.
playerPolicyInfoUtil.playerPolicyInfoPromise(localPlayer):andThen(function(playerPolicyInfo)
print(playerPolicyInfo.ArePaidRandomItemsRestricted)
print(playerPolicyInfo.AllowedExternalLinkReferences)
print(playerPolicyInfo.IsPaidItemTradingAllowed)
print(playerPolicyInfo.IsSubjectToChinaPolicies)
end):catch(function(defaultPlayerPolicyInfo, errorMessage)
warn(string.format("Error retrieving player policy info because %s", errorMessage))
end)
Types
PlayerPolicyInfo
interface
PlayerPolicyInfo {
ArePaidRandomItemsRestricted:
boolean
AllowedExternalLinkReferences:
{
string
}
IsPaidItemTradingAllowed:
boolean
IsSubjectToChinaPolicies:
boolean
}
DEFAULT_PLAYER_POLICY_INFO
Constantinterface
DEFAULT_PLAYER_POLICY_INFO {
ArePaidRandomItemsRestricted:
false
AllowedExternalLinkReferences:
{
}
IsPaidItemTradingAllowed:
false
IsSubjectToChinaPolicies:
false
}
WARNING
Constant, not accessible within playerPolicyInfoUtil
.
Functions
playerPolicyInfoPromise
Returns a promise which is resolved with a read only policy info dictionary for the given player.
If the promise rejects, then the promise will reject with a read only copy of DEFAULT_PLAYER_POLICY_INFO and an error message.
playerPolicyInfoUtil.playerPolicyInfoPromise(somePlayer):andThen(function(policyInfo)
print(policyInfo.ArePaidRandomItemsRestricted)
end):catch(function(defaultPlayerPolicyInfo, errorMessage)
warn(defaultPlayerPolicyInfo, tostring(errorMessage))
end)
Read only policy info
The policy info table will be read-only, through table.freeze.