[英]How to insert a table in to group in Corona SDK (.Lua)?
I get error message when i try to insert a table into a group 当我尝试将表插入组时出现错误消息
My table code is containing images 我的表格代码包含图片
Here is the code i am using for the table 这是我用于表格的代码
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
and here is the code for group 这是组的代码
GUI:insert(myJoints);
i have my background image in the GUI group and it is covering the table. 我在GUI组中有我的背景图像,它覆盖了表格。
I don't know if it is actually possible to insert table into a group 我不知道实际上是否可以将表格插入组中
Any help please 任何帮助请
Thanks in Advance! 提前致谢!
You can't insert a table into a group using the "insert" method because that method is looking for a display object. 您无法使用“插入”方法将表插入组中,因为该方法正在寻找显示对象。 Try calling
GUI.myJoints = myJoints
. 尝试调用
GUI.myJoints = myJoints
。 Also keep in mind that your table just references your display objects, which is different from having them in a group. 还请记住,表仅引用显示对象,这与将它们归为一组不同。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.