Type Function Library plugin.ageRange.* Return value none Revision Release 2025.3721 Keywords age range, age verification, parental controls, initialization See also plugin.ageRange.requestAgeRange() ageRange
Initializes the Age Range plugin and sets up the listener function to receive age verification, significant update, and communication events.
plugin.ageRange.init( listener )
Listener. Function that will receive age range events including: - ageRangeEvent - Age verification responses - significantUpdateEvent - App update approval responses - communicationEvent - Communication permission responses
local ageRange = require("plugin.ageRange")
local function ageRangeListener(event)
if event.name == "ageRangeEvent" then
if event.isError then
print("Error:", event.errorMessage)
elseif not event.isAvailable then
print("Age range not available")
elseif event.declined then
print("User declined to share age range")
else
print("Lower bound:", event.lowerBound)
print("Upper bound:", event.upperBound)
print("User status:", event.userStatus)
print("Has parental controls:", event.hasParentalControls)
end
elseif event.name == "significantUpdateEvent" then
if event.questionSent then
print("Update permission request sent")
elseif event.approved then
print("Parent approved the update")
else
print("Parent denied the update")
end
elseif event.name == "communicationEvent" then
if event.questionSent then
print("Communication request sent")
elseif event.approved then
print("Communication approved")
else
print("Communication denied")
end
end
end
-- Initialize the plugin
ageRange.init(ageRangeListener)