title: Lua - Extending Tables in loops
body: <p>Note: This is in <a href="http://www.wiki.roblox.com/" rel="nofollow">Roblox's version of Lua</a>.
  I have the following snippet of code:</p>
  
  <pre><code>for index, child in pairs(workspace.IMG:GetChildren()) do
      xyz = child.Position
      ImgScript = {}
      table.insert(ImgScript, -1, child.BrickColor.Number, xyz.X, xyz.Y, xyz.Z)
  end
  </code></pre>
  
  <p>So <code>workspace.IMG</code> is a model that has a bunch of bricks in it. I am trying to turn that model into a script for <a href="http://www.roblox.com/games/20279777/Voidacitys-Script-Builder-Working-Local" rel="nofollow">script builder</a>. So I could make it do <code>Instance.new('Part', script) blah blah blah</code> for every brick, but that amounts to a large script. So instead I am making a table that has all of the necessary information (BrickColor and Position). Here is what I want the table to look like:</p>
  
  <pre><code>{{BrickColor Number, X, Y, Z}, {123, 14, 52, 65}, {156, 13, 52, 65}, etc.}
  </code></pre>
  
  <p>But the script I currently have doesn't make this kind of table. It doesn't do anything; In fact, I don't expect it to do what I am asking; I just don't know how to make it make this kind of table.</p>