Attempt to call Nil value (Line 14)

I’m getting this error. What is wrong?


JOBS = {}

JOB_UNEMPLOYED = 1
JOB_POLICE = 2
JOB_ARMEDP = 3
JOB_MEDIC = 4
JOB_FIREFIGHTER = 5
JOB_FIRECHIEF = 6
JOB_MEDICCHIEF = 7
JOB_POLICECHIEF = 8
JOB_PMGUARD = 9
JOB_PM = 10

JOBS[JOB_UNEMPLOYED]{
    name = "Unemployed",
    salary = 454,
    weapons = {""},
    color = Color(0, 255, 0),
    model = "",
}
JOBS[JOB_POLICE]{
    name = "Police officer",
    salary = 2000,
    weapons = {""},
    color = Color(0, 0, 255),
    model = "",
}
JOBS[JOB_ARMEDP]{
    name = "Armed police officer",
    salary = 2916,
    weapons = {""},
    color = Color(141, 174, 89),
    model = "",
}
JOBS[JOB_MEDIC]{
    name = "Paramedic",
    salary = 2125,
    weapons = {""},
    color = Color(255, 0, 255),
    model = "",
}
JOBS[JOB_FIREFIGHTER]{
    name = "Fire fighter",
    salary = 1741,
    weapons = {""},
    color = Color(255, 153, 7),
    model = "",
}
JOBS[JOB_FIRECHIEF]{
    name = "Area manager (FIRE)",
    salary = 3916,
    weapons = {""},
    color = Color(255, 153, 7),
    model = "",
}
JOBS[JOB_MEDICCHIEF]{
    name = "Area manager (MEDIC)",
    salary = 2666,
    weapons = {""},
    color = Color(255, 153, 7),
    model = "",
}
JOBS[JOB_POLICECHIEF]{
    name = "Area manager (POLICE)",
    salary = 4393,
    weapons = {""},
    color = Color(255, 153, 7),
    model = "",
}
JOBS[JOB_PMGUARD]{
    name = "Prime Minister's Guard",
    salary = 3333,
    weapons = {""},
    color = Color(255, 153, 7),
    model = "",
}
JOBS[JOB_PM]{
    name = "Prime Minister",
    salary = 11875,
    weapons = {""},
    color = Color(255, 153, 7),
    model = "",
}

team.SetUp( JOB_UNEMPLOYED, JOBS[JOB_UNEMPLOYED].name, JOBS[JOB_UNEMPLOYED].color)
team.SetUp( JOB_POLICE, JOBS[JOB_POLICE].name, JOBS[JOB_POLICE].color)
team.SetUp( JOB_ARMEDP, JOBS[JOB_ARMEDP].name, JOBS[JOB_ARMEDP].color)
team.SetUp( JOB_MEDIC, JOBS[JOB_MEDIC].name, JOBS[JOB_MEDIC].color)
team.SetUp( JOB_FIREFIGHTER, JOBS[JOB_FIREFIGHTER].name, JOBS[JOB_FIREFIGHTER].color)
team.SetUp( JOB_FIRECHIEF, JOBS[JOB_FIRECHIEF].name, JOBS[JOB_FIRECHIEF].color)
team.SetUp( JOB_MEDICCHIEF, JOBS[JOB_MEDICCHIEF].name, JOBS[JOB_MEDICCHIEF].color)
team.SetUp( JOB_POLICECHIEF, JOBS[JOB_POLICECHIEF].name, JOBS[JOB_POLICECHIEF].color)
team.SetUp( JOB_PMGUARD, JOBS[JOB_PMGUARD].name, JOBS[JOB_PMGUARD].color)
team.SetUp( JOB_PM, JOBS[JOB_PM].name, JOBS[JOB_PM].color)

You’re calling what you index JOBS with by using curly braces like that. Make sure you use “=” because you’re defining something.

Found the problem.

My bad. xD