Reputation: 1051
Seems like this should be pretty simple, but I'm finding it frustratingly difficult to get right. Rather than jam all my images into my project's base directory, I'm placing them in a subdirectory named "images". However when I try to load an image from this directory, I receive:
ERROR: bad argument #2 to display.newImageRect(): width expected, but got string.
local background = display.newImageRect( "menu-bg.jpg", "images/", 570, 360 )
From the docs, I don't see any problems with the syntax. Is this a bug with the display library, or the docs, or am I handling the baseDir property wrong (and seeing a wonky error message)?
Upvotes: 2
Views: 283
Reputation: 1051
Ok after fiddling with this some more, it looks like I can append the path to the filename, e.g.
local background = display.newImageRect( "images/menu-bg.jpg", 570, 360 )
In other words, I misunderstood the meaning of "baseDir".
Upvotes: 2