I'm trying to work on a game similar to Jeopardy. Instead the game starts immediately with a random question is chosen from a table. I'm a bit newbish to Love but I do understand the basics of Lua.
Code: Select all
local question = {}
function question.load()
q = {
{ id = 1, text = "Is LOVE 2D Cool?", ch1 = "Yes", ch2 = "No", ch3 = "Probably", ch4 = "Indefinitely", correct = ch1 },
{ id = 2, text = "Is Lua easy?", a = "No", b = "Yes", c = "Indefinitely", d = "Probably", correct = b }
}
end
function question.get( id )
return q[math.random(#q)]
end
function question.getcorrect( id, correct )
end
function question.draw( text, ch1, ch2, ch3, ch4, correct )
print(question.get(id)) -- just here for debug
end
return question
Code: Select all
table: 0x0252b768