local questions={
EN={
Q1={"",""},
Q2={"",""},
Q3={"",""},
Q4={"",""},
Q5={"",""},
Q6={"",""},
Q7={"",""},
Q8={"",""},
Q9={"",""},
Q10={"",""}
},
BR={
Q1={"",""},
Q2={"",""},
Q3={"",""},
Q4={"",""},
Q5={"",""},
Q6={"",""},
Q7={"",""},
Q8={"",""},
Q9={"",""},
Q10={"",""}
},
TR={
Q1={"",""},
Q2={"",""},
Q3={"",""},
Q4={"",""},
Q5={"",""},
Q6={"",""},
Q7={"",""},
Q8={"",""},
Q9={"",""},
Q10={"",""}
}
}
local current_question = questions.EN.Q..math.random(1,10)[1]
我想让current_question
变量从questions
表中返回一个随机问题,但它会给我一个错误; “尝试索引?(数字值)”
答案 0 :(得分:2)
您需要告诉解释器Q..math.random(1,10)
是这样的一个字符串:
local current_question = questions.EN["Q"..math.random(1,10)][1]