Q:

Elseifs being skipped in Lua

I started to work on a little Game-Dev project in Lua, and am having trouble with this part of my code:
    if genrel == RPG and langl == BASIC and topicl == WAR then
        review = math.random(2, 5)
        review2 = math.random(2, 5)
        review3 = math.random(2, 3)
        money = money + 300
        print("You have earned a total of $300 dollars from your game. Overall not many people enjoyed the game.")

elseif genrel == RPG and langl == BASIC and topicl == "WESTERN" then
        review = math.random(7, 9)
        review2 = math.random(4, 9)
        review3 = math.random(5, 8)
    money = money + 400
    print("You have earned a total of $300 dollars from your game. The game recieved mixed reviews.")

topicl, langl, and genrel, are defined earlier in the code.
Example:
topicChoice = io.read()
if topicChoice == 'War' then
topic = "[War]"
topicl = WAR

progLang = io.read()
if progLang == 'Java' then
lang = "[JAVA]"
langl = JAVA

genreChoice = io.read()
if genreChoice == 'ACTION' then
genre = "[ACTION]"
genrel = ACTION

Everything is defined, but when I run the code the random numbers outputted are the first ones under the if, no matter what I put in. This may be hard to understand, so here is my full code.
http://pastebin.com/XS3aEVFS
Summary: The program decides what random numbers are shown by determining what the genre, topic, and coding language are. Instead of selecting the numbers by genre, topic, and coding language, it simply uses the first if statement.

A:

Early in your code you have this:
if genreChoice == 'ACTION' then
    genre = "[ACTION]"
    genrel = ACTION     
elseif genreChoice == 'RPG' then
    genre = "[RPG]"
    genrel = RPG     
elseif genreChoice == 'SIM' then
    genre = "[SIM]"
    genrel = SIM     
end

and you assign to genrel the value of the variables ACTION, RPG and SIM, but those variables don't appear to have been defined anywhere, thus their value is nil. In other words when you execute:
genrel = ACTION     

is the same as if you did:
genrel = nil     

