2013-05-11 68 views
0

我收到錯誤消息當我嘗試將表格插入一組如何在Corona SDK(.Lua)中將表插入到組中?

我的表的代碼包含圖像

這裏是代碼我使用的表

local myJoints = {} 

for i = 1,5 do 
    local link = {} 
    for j = 1,17 do 
     link[j] = display.newImage("link.png") 
     link[j].x = 121 + (i*34) 
     link[j].y = 55 + (j*17) 
     physics.addBody(link[j], { density=2.0, friction=0, bounce=0 }) 

     -- Create joints between links 
     if (j > 1) then 
      prevLink = link[j-1] -- each link is joined with the one above it 
     else 
      prevLink = wall -- top link is joined to overhanging beam 
     end 
      myJoints[#myJoints + 1] = physics.newJoint("pivot", prevLink, link[j], 121 + (i*34), 46 + (j*17)) 
    end 
end 

,這裏是組的代碼

GUI:insert(myJoints); 

我在GUI組中有我的背景圖像,它覆蓋了表格。

我不知道它實際上是可以預先插入表成團

任何幫助,請

謝謝!

回答

0

您不能使用「插入」方法將表插入組中,因爲該方法正在查找顯示對象。嘗試撥打GUI.myJoints = myJoints。另外請記住,您的表只是引用您的顯示對象,這與將它們放入組中不同。

相關問題