How to tell number of objects in a scene?

Hello,

From what I understand is I am limited to 200 objects and variables per scene. Is there a way from the simulator to tell how many I have? I know I should define then at the top and just count. I think I am going to create tables for objects so I can have several under one table name. But curious how I can tell how many. I assume count. lol

Warren

Hi Warren,

I think there’s some confusion here. There is no imposed limit of 200 display objects per scene… you can keep adding them, but at some point you’ll kill performance level to a point where the app may crash. On the variable side, Lua does impose a limit of the number of distinct local variables, but that is easily circumvented by practical, smart variable organization like nesting variables within other tables, etc.

You can check how many display objects you’ve put in a scene/group by using the .numChildren property, if you’re curious.

https://docs.coronalabs.com/api/type/GroupObject/numChildren.html

Best regards,

Brent

Hi Warren,

I think there’s some confusion here. There is no imposed limit of 200 display objects per scene… you can keep adding them, but at some point you’ll kill performance level to a point where the app may crash. On the variable side, Lua does impose a limit of the number of distinct local variables, but that is easily circumvented by practical, smart variable organization like nesting variables within other tables, etc.

You can check how many display objects you’ve put in a scene/group by using the .numChildren property, if you’re curious.

https://docs.coronalabs.com/api/type/GroupObject/numChildren.html

Best regards,

Brent