So it’s a flashcard app where currentCard is the current card the user sees on screen and questionsAndAnswers is the table of questions and answers (ingenious I know haha). The following code is for my questionsAnsdAnswers table and for when they click to go onto the NEXT card.
Blue text is terminal readings … edit: I guess I cant color code lua code here so It now has double brackets [[ ]]
Red text is where I think error is edit: now has double parenthesis (( ))
[lua]
local questionsAndAnswers = {
{Q = “Question 1: What is 1 + 2?”, A = “Answer 1: equals 3”, location = nil},
{Q = “Question 2: What is 2 + 2?”, A = “Answer 2: equals 4”}
}
[/lua]
[lua]
print ("this is currentCard: "…currentCard) [[this is currentCard: 1]]
print ("this is current text.text: "…text.text) [[this is current text.text: Question 1: What is 1 + 2?]]
if (currentCard+1 <= #questionsAndAnswers) then
currentCard = currentCard+1
print ("1This is current card now "…currentCard) [[1This is current card now 2]]
print (questionsAndAnswers[currentCard].Q) [[Question 2: What is 2 + 2]] ((This is what I want text.text to be))
–text.text = questionsAndAnswers[currentCard].Q ((Neither this nor the following line changes it
text.text = (questionsAndAnswers[currentCard].Q) even though I can make the print statement above to show
what I want.))
–markedStatusText.text = “”
print ("this is text.text "…text.text) [[This is text.text Question 1: What is 1 + 2?]]
print ("printing statement1: "… text.text) [[printing statement1: Question 1: What is 1 + 2?]]
if (marked[tonumber(string.match (string.sub( text.text, 8 , 13 ), “%d+”))] == true) then
–00
for k, v in pairs( marked ) do
print(k, v)
end
– add print statement here (4/27/16)
markedStatusText.text = “Marked”
print (“making markedStatusText say marked”)
else
print (“making markedStatusText become nil”) [[making markedStatusText become nil]]
markedStatusText.text = “”
end[/lua]
Any ideas are welcome! I even tried to put "text.text == questionsAndAnswers[currentCard].Q " But then corona simulator doesn’t start up saying that it expects “=” where “==” is
Thanks!