Ways to store data?

Are there any good ways to store non-persistent data asides the one I’m using now? For now, I’m using tables to store data that does not need to persist, and if I need to store a data for a player such as points in current session or something similar, I use the player’s name as a key… Is there any other/better way to do that?

For persistent data, it would obviously be best to use a database, are there any tutorials on that?

Thanks, any help is appreciated.

Use their SteamID as the key instead of the player’s name.

Where do you want to store the persistent data? On the server’s local database, a remote database or both?

Either. I’m more interested in storing non-persistent data however.

If you want to store non-persistent data, there’s no need to use a database unless you really want or need to. Just use a Lua table.

Yeah. I know. I’m just wondering if there’s a better way than using the player’s name as a key for the table

Okay. What about stuff such as stamina? Where would one store that? Same way?

You could nest the tables like this:

[lua]local data = {
[“STEAM_0:1:40314158”] = {
stamina = 100,
score = 5,
},
}[/lua]

is there any reason you can’t store data on the entity itself?
[lua]ply.Stamina = 100[/lua]