Why display.newImage returns a table when the filename is an empty string ?

Hello, I get stucked a long time because of strange behaviour:

print( display.newImage("",0,0) ) => table instead of nil, why?

The same with display.newImage("                   ",0,0)

Hi @waltsir,

I must ask the obvious question here: why are you trying to create an image without an image file reference?

Brent

Good question :slight_smile: In fact my app just tested the value returned and not the filename entered. A nil value would be an invalid input filename , and a table a valid file . The rest of the program worked on that returned table. Easy to test now but surprising the first time.

Hi @waltsir,

I must ask the obvious question here: why are you trying to create an image without an image file reference?

Brent

Good question :slight_smile: In fact my app just tested the value returned and not the filename entered. A nil value would be an invalid input filename , and a table a valid file . The rest of the program worked on that returned table. Easy to test now but surprising the first time.