1
我遇到了與我的表有關的問題。我無法將表格連接到我的其他lua文件。我在本地lblGiven = display.newText上有錯誤。它顯示Error bad argument#-1 newText。該程序的機制是如果您單擊按鈕,表格的一個部分將顯示爲標籤。Corona sdk將表連接到其他lua file.Error錯誤參數#-1 newText
這是我的文件名爲questions.lua
local M = {
{
"What is the answer 1",
answer = "17",
},
{
"What is the answer 2",
answer = "18",
},
{
"What is the answer 3",
answer = "25",
},
},
return M
這是我main.lua
local given = require("questions")
local lblGiven = display.newText(
{
text = given[math.random(#given)],
x = 160,
y = 310,
font = native.systemFont,
align = "center"
}
)