A Table for GameModes

Is there anyway i could maybe improve this? Its used for a game that selects gamemodes randomly and when its selected, it uses data from this table to make adjustments.

 local gamemodes = {

   TDM = {

	Time = ": 60",	

		Respawn = true,
		
			pointLimit = ": 20",


		};

     FreeForAll = {

             Time = ": 60",	

	           Respawn = false,
		
		         pointLimit = ": None",
      }

  }

Well for one, the time should really be numbers instead of a string. I understand why you’re doing it, for test purposes but it’s just overall a better method to not have to make that a string and instead change the text to something like ": "… Time. If that makes sense. Same for the point limit as well.

Also, siblings should not b be indented over. So it would make much more sense to do

>     Time,
>     Respawn

instead of

> Time
>       Respawn

This is just preference but overall good practice I find to do it this way. But yeah, data such as that makes more sense to keep point limit and time from being strings and to have whatever handles the data handle the measures for what is and isn’t, for instance pointLimit could either be a number or false and if it’s false then have the functionality change it to it’s own set of text.

Hope this helped and forgive me if you don’t understand all of it, kinda late here but if you have any questions feel free to ask :slight_smile:

4 Likes

Thank you for your insight on my Table. I’ll use your suggestions