How do I grab a value from a table?

I’m making a custom HUD for my server and I’m trying to figure out how to grab a value from this table and set it equal to another variable. The value I’m trying to take from it is the “color” variable. It’s not global so I can’t just put color obviously, and I’ve already tried making a for loop to no avail. If anyone could help me out that would be great.


TEAM_CITIZEN = DarkRP.createJob("Citizen", {
	color = Color(20, 150, 20, 255),
	model = {
		"models/player/Group01/Male_07.mdl",
		"models/player/Group01/Male_02.mdl",
		//"models/player/Group01/male_03.mdl",
		"models/player/Group01/Male_04.mdl",
		"models/player/Group01/Male_05.mdl",
		"models/player/Group01/Male_06.mdl",
		//"models/player/group01/male_01.mdl",
		"models/player/Group01/Male_08.mdl",
		"models/player/Group01/Male_09.mdl"
	},
	description = [[Citizen]],
	weapons = {},
	command = "citizen",
	max = 0,
	salary = GAMEMODE.Config.normalsalary,
	admin = 0,
	vote = false,
	hasLicense = false,
	candemote = false
})

I’m working on a near-full rewrite of team to provide additional functionality, associative teams ( meaning more than one “team” can be associated to an id, and that id becomes the team reference so spawns can be for the associated id, or for the specific TEAM_*

It’ll make things easier…

But, you can use: team.GetColor( TEAM_CITIZEN ); and team.SetColor( TEAM_CITIZEN, color_white ); and where color_white is you’d set the new team color.

Also, note… The specific “table” you’re referencing is local to that function meaning nothing outside of the scope of the function knows about it or can access it. If you want a table that you can access you’ll need to set it in the scope of the file ( local blah = { … }; then add it to the jobs table, however the DarkRP function likely copies the values to new address points meaning editing the local table may not work any longer.

https://dl.dropboxusercontent.com/u/26074909/tutoring/tables/quick_intro_to_tables.lua.html