Messing with tables
Posted: Mon Apr 27, 2015 12:26 pm
Hello! Today im creating some "Trivial" game, and im having problems with a table. Im getting this error
Any clue
Yes a strange "unexpected symbol" but i dont think is my fault, cause it still work on Windows (Love 0.9.0), but when i get in my Linux pc (Love 0.8.0) this keep failing. This is my code:Error: Syntax error: questions.lua:42: unexpected symbol near '='
stack traceback:
[C]: ?
[C]: in function 'require'
main.lua:2: in main chunk
[C]: in function 'require'
[string "boot.lua"]31: in function <[string "boot.lua"]:227>
[C]: in function 'xpcall'
Code: Select all
--Table Defs.
questions = {}
questions[1] = {} --Tier1
questions[1][1] = {} --Q1
questions[1][1][1] = "¿Qué profesion tenia Torre Isunza?" --Question1
questions[1][1][2] = "Escultor" --Ans1
questions[1][1][3] = "Escritor" --Ans2
questions[1][1][4] = "Pintor" --Ans3
questions[1][1][5] = 1 --RightAnswer
questions[1][2] = {} --Q2
questions[1][2][1] = "¿En qué año nació Torre Isunza?" --Question1
questions[1][2][2] = "1734" --Ans1
questions[1][2][3] = "1892" --Ans2
questions[1][2][4] = "1987" --Ans3
questions[1][2][5] = 2 --RightAnswer
questions[1][3] = {} --Q3
questions[1][3][1] = "¿En qué año murió Torre Isunza?" --Question1
questions[1][3][2] = "2011" --Ans1
questions[1][3][3] = "1982" --Ans2
questions[1][3][4] = "1945" --Ans3
questions[1][3][5] = 2 --RightAnswer
questions[2] = {} --Tier2
questions[2][1] = {} --Q1
questions[2][1][1] = "QuestionTest2" --Question1
questions[2][1][2] = "arrayAns12" --Ans1
questions[2][1][3] = "arrayAns22" --Ans2
questions[2][1][4] = "arrayAns32" --Ans3
questions[2][1][5] = 2 --RightAnswer
questions[2][2] = {} --Q2
questions[2][2][1] = "QuestionTest2" --Question1
questions[2][2][2] = "arrayAns12" --Ans1
questions[2][2][3] = "arrayAns22" --Ans2
questions[2][2][4] = "arrayAns32" --Ans3
questions[2][2][5] = 2 --RightAnswer
questions[2][3] = {} --Q3
questions[2][3][1] = "¿En qué años ganó la primera y segunda medalla Torres Isunza?" --Question1
questions[2][3][2] = "1989 y 1999" --Ans1
questions[2][3][3] = "1890 y 1930" --Ans2
questions[2][3][4] = "1922 y 1930" --Ans3
questions[2][3][5] = --RightAnswer
questions[3] = {} --Tier3
questions[3][1] = {} --Q3
questions[3][1][1] = "QuestionTest3" --Question1
questions[3][1][2] = "arrayAns13" --Ans1
questions[3][1][3] = "arrayAns23" --Ans2
questions[3][1][4] = "arrayAns33" --Ans3
questions[3][1][5] = 3 --RightAnswer
questions[3][2] = {} --Q3
questions[3][2][1] = "QuestionTest3" --Question1
questions[3][2][2] = "arrayAns13" --Ans1
questions[3][2][3] = "arrayAns23" --Ans2
questions[3][2][4] = "arrayAns33" --Ans3
questions[3][2][5] = 3 --RightAnswer
questions[3][3] = {} --Q3
questions[3][3][1] = "QuestionTest3" --Question1
questions[3][3][2] = "arrayAns13" --Ans1
questions[3][3][3] = "arrayAns23" --Ans2
questions[3][3][4] = "arrayAns33" --Ans3
questions[3][3][5] = 3 --RightAnswer
clues = {}
--Define some Question values
questionNumber = 1
actualQuestion = "Test"
actualAns1 = "true"
actualAns2 = "false1"
actualAns3 = "false2"
actualRealAns = 1
questionTier = 1
function retrieveQuestion(questionTier)
questionNumber = math.random(1)
actualQuestion = questions[questionTier][questionNumber][1]
actualAns1 = questions[questionTier][questionNumber][2]
actualAns2 = questions[questionTier][questionNumber][3]
actualAns3 = questions[questionTier][questionNumber][4]
actualRealAns = questions[questionTier][questionNumber][5]
end