Somehow I just don't get it...
I have three Sprites: Group, sprite1, sprite2
Group is en empty Sprite. The two others are Lines. Then I parent them:
Group:addChild( sprite1 )
Group:addChild( sprite2 )
stage:addChild( Group ) |
Look at the output of stage! The parenting doesn't work! Every sprite points to itself as parent and child. Should't sprite1 and sprite2 point to Group as a __parent?
stage = {
| __userdata = "userdata: 0x10610fd28"
| __children = {
| | userdata: 0x104e8c330 = {
| | | id = "Group"
| | | __parent = {} -- stage (self reference)
| | | __userdata = "userdata: 0x10611d1c8"
| | | __children = {
| | | | userdata: 0x104e89310 = {
| | | | | id = "sprite1"
| | | | | __parent = {} -- stage.__children.userdata: 0x104e8c330 (self reference)
| | | | | __children = {
| | | | | | userdata: 0x104e804e0 = {
| | | | | | | __userdata = "userdata: 0x10611d238"
| | | | | | | __parent = {} -- stage.__children.userdata: 0x104e8c330.__children.userdata: 0x104e89310 (self reference)
| | | | | | }
| | | | | }
| | | | | __userdata = "userdata: 0x10611f8b8"
| | | | }
| | | | userdata: 0x104e80770 = {
| | | | | id = "sprite2"
| | | | | __parent = {} -- stage.__children.userdata: 0x104e8c330 (self reference)
| | | | | __children = {
| | | | | | userdata: 0x104e7bb90 = {
| | | | | | | __userdata = "userdata: 0x10611b008"
| | | | | | | __parent = {} -- stage.__children.userdata: 0x104e8c330.__children.userdata: 0x104e80770 (self reference)
| | | | | | }
| | | | | }
| | | | | __userdata = "userdata: 0x106124178"
| | | | }
| | | }
| | }
| }
} |
Comments
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
--ND
How did you use the inspect.lua to get this clean output? When I was using it, it gave me the metatables and other things also, so the output was confusing and unreadable due to a lot of data.
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!
Also, I don't think you're print routine is giving you wrong results...just difficult to interpret results.
»Gideros Illustrator« - [svg|xml] scene designer using Adobe Illustrator®™ Within one line of code!