How would I go about saving an unknown/unlimited amount of values?

I’m trying to create a character creation system where players can have vehicles registered to their character. The problem I’m facing is how I would save all the cars the player has registered to that select character. I don’t want to make a hard-limit on how many vehicles per character and instead make it basically infinite but don’t have a good way to go about this.

I’m also considering using Datastore2 as I’ve heard it is much more reliable than an ordinary datastore.

Any feedback would be appreciated. Thanks.

You would most likely die of old age before you could surpass the datastore limits for a single key. Seriously

Just set up your data store without allowing auto clicking. The limit you HAVE to impose is the max amount of cars your players are allowed to have spawned at one time. Yes DataStore2 is quite useful and has many redundancies and makes saving ordered tables quite simple. Also combining keys allows you to save all your data into a single big dictionary and only have to remember one single key to access it.

If I don’t know how long the word is, I cannot write char m[6]; ,
The length of the word is maybe ten or twenty long. How can I use scanf to get input from the keyboard?

#include <stdio.h>
int main(void)
    char  m[6];
    printf("please input a string with length=5\n");
    printf("this is the string: %s\n", m);
    return 0;

please input a string with lenght=5
this is the string: hello

This is a Lua forum, not a C++ one. Please check StackOverflow for these problems

Thanks for your help. I’m extremely new to Datastore2 (and still somewhat beginner at Datastores in general) but I just managed to figure out a way to save all the vehicles in a table that can be added too. Knowing that I will die before reaching that datastore limit definitely helps clear up some of my fears lol.