display.newRect() has critical issue!

This may not be the only problem with newRect (). The code below works differently. Calling insert () is normal and does not appear on the screen if you include the parent.

I received an error report several times from Fabric.io. The problem is that the first argument to newRect () is not a number. The first argument in my code was a group.

correct ::

local box = ... local gap = display.newRect(0, 0, 320, 150) gap.y = 150 box:insert(gap)

Incorrect ::

local box = ... local gap = display.newRect(box, 0, 0, 320, 150) gap.y = 150

Will need more code to actually fix this but are you sure that “box” is definitely a group? It’s not somehow been set to something else by mistake somewhere or gone out of scope somewhere so that when you try to insert something into it it’s not a group anymore?

Thank you for your reply. :slight_smile:

The box is a group absolutely. Because you can see the screenshots between insert() code and parameter code.

We need more detail to be able to help. If display.newRect really had a critical issue, it would have picked up at some point in the last 8 years.

So something else must be going on.

any chance display.newRect has been replaced?  (aka “monkey-patched”, similar to the way the widgets lib replaces display.newGroup)

if so, then perhaps the replacement isn’t properly handling the 5-argument form.

at top of main.lua do:  print(display.newRect)

then do again just prior to the use shown in this post, and see if they print out the same function address

Will need more code to actually fix this but are you sure that “box” is definitely a group? It’s not somehow been set to something else by mistake somewhere or gone out of scope somewhere so that when you try to insert something into it it’s not a group anymore?

Thank you for your reply. :slight_smile:

The box is a group absolutely. Because you can see the screenshots between insert() code and parameter code.

We need more detail to be able to help. If display.newRect really had a critical issue, it would have picked up at some point in the last 8 years.

So something else must be going on.

any chance display.newRect has been replaced?  (aka “monkey-patched”, similar to the way the widgets lib replaces display.newGroup)

if so, then perhaps the replacement isn’t properly handling the 5-argument form.

at top of main.lua do:  print(display.newRect)

then do again just prior to the use shown in this post, and see if they print out the same function address