[quote] [quote=“Dinizterz” post=112053]Anyone else find it inconvenient that you can only iterate through OrderedDataStores? The only reason I use OrderedDataStores is because I can iterate through them and collect data, such as a ban list, returning the names/userIds of those who are banned (key) and any detail for that key (value). What I mean by iterate is to be able to go through an entire datastore using only 1 Get() function like :GetSortedAsync does with OrderedDataStores. Regular Data Stores can’t do this, or can they? Couldn’t find anything on the wiki. It’s inconvenient because I’m then forced to use integers. I have to use a Legend to decode what each integer means, like
oneLegend = {
[“1”] = “Hack Exploiting”,
[“2”] = “Glitch Exploiting”,
[“3”] = “Player Abuse”
}
When I could just use the words themselves. [/quote]
Uh, why not just do something like
thingy:UpdateAsync("banned",function(old)
--ban user
old[userIdHere]="Reason here"
return old
end
To iterate through all the banned players, simply use call pairs on the table returned from GetAsync.
If you need to store the name and id AND reason all in the same key for whatever reason (which you shouldn’t, btw, it’s rather silly since we can just get the username from the id anyways, and the usernames can change) you can set old[useridHere] to something like {usernameHere,reasonHere} or even do something like old[userIdHere…“:”…usernameHere]=reasonHere to store both in one key.
But don’t do that.[/quote]
What I do is just throw all my data into a table anyway. That’s also why I focused on making the table editor on this plugin a highh importance.[/quote]
That’s a thing you probably shouldn’t do either, because if you ever need to listen to OnUpdate, you’ll have lots of meaningless data filling up your request limit. If I want to listen to OnUpdate of, say, a list of active “servers” (using CreatePlace), I don’t want to have to listen to EVERY SINGLE UPDATE EVER.
So yeah, you should put them into keys that are relevant to, y’know, the data itself.