Lua:在表中添加表

Lua:在表中添加表,lua,Lua,如何将一个表添加到另一个表中?所以看起来是这样的 local test = { { Resource = "test", }, }, 嗯,我写这篇文章只是因为这篇文章大部分是代码,因此必须放更多的文本。 所以请忽略这一部分:)祝你新年好 local test = { { Resource = "test", { File = "this is a

如何将一个表添加到另一个表中?所以看起来是这样的

local test = {
    {
        Resource = "test",
    },
},


嗯,我写这篇文章只是因为这篇文章大部分是代码,因此必须放更多的文本。 所以请忽略这一部分:)祝你新年好

local test = {
    {
        Resource = "test",
        {
            File = "this is a test",
            Code = "this is a test",
        },
        {
            File = "this is a test",
            Code = "this is a test",
        },
    },
}


?您提供的代码运行良好,您希望它做什么?如果我在脚本中这样做,它将计算并将其放入表中。但是它需要在不覆盖var资源的情况下创建一个表
local test = {
    {
        Resource = "test",
    },
}

for i = 1,2 do
   test[1][i] = {
            File = "this is a test",
            Code = "this is a test",
        }
end
for _ = 1,2 do
  table.insert(test[1], {
            File = "this is a test",
            Code = "this is a test",
        }
end