0
我想創建這樣電暈多維表
answers = {}
for i = 1, #answers do
answers[i] = { wrong = t[i], wrong2 = t2[i], right = t3[i]}
end
print(answers[1].wrong)
一多維表但當我嘗試訪問的答案[1] .wrong,我得到錯誤:「?」試圖索引字段(零值) 但是,當我這樣做,這樣它打印對我來說
answers = {
{wrong = t[1], wrong2 = t2[1],right = t3[1]},
{wrong = t[2], wrong2 = t2[2],right = t3[2]}
}
print("----------")
print(answers[1].wrong)
print(answers[1].wrong2)
爲什麼不工作的第一種方法?
謝謝尼科爾,我的錯誤非常愚蠢 – Gooner