MadStudioRoblox / ProfileService

Universal session-locked savable table API
https://madstudioroblox.github.io/ProfileService/
Apache License 2.0
298 stars 158 forks source link

Optional datastore scope in GetProfileStore() #10

Closed Meta-Maxim closed 3 years ago

Meta-Maxim commented 3 years ago

Added an optional scope parameter to GetProfileStore()

LM-loleris commented 3 years ago

My personal opinion is that DataStore scopes should be instead turned into prefixes / suffixes in store names and that an additional scope variable is redundant. Do you have any additional thoughts / info on the reason of this PR?

Meta-Maxim commented 3 years ago

My personal opinion is that DataStore scopes should be instead turned into prefixes / suffixes in store names and that an additional scope variable is redundant. Do you have any additional thoughts / info on the reason of this PR?

Why do you think scopes are better as string prefixes when a specific argument exists? I think they're less clean:

You're concatenating strings for no reason and you're introducing a implicit mapping process / id system: [scope, dataStoreName] -> scopeAndNameID to then use as the datastore index when the Roblox API already provides clean scoping API.

I use scope with all systems under one scope, and I reset the whole game data when testing before release for example, or have studio-only data. The tradeoff seems to be concatenation vs. passing an argument, and I feel that an argument is cleaner code as the two strings passed are then logical units (as they are in my use case two different global variables): dataStoreName and gameScope (studio, live-game, pre-release).

The scope is also not guaranteed to be redundant as Roblox-side datastores might use the scope internally quicker / not connect to data outside of scope for performance benefits???

LM-loleris commented 3 years ago

Thank you for your contribution! Your proposed feature has been added.

You can find documentation for it here: https://madstudioroblox.github.io/ProfileService/api/#profileservicegetprofilestore