0.10.1: newImageData error

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Gip-Gip
Prole
Posts: 2
Joined: Sun Aug 14, 2016 3:35 am

0.10.1: newImageData error

Post by Gip-Gip »

When trying to use love.image.newImageData like this:

Code: Select all

function love.load()
    veiwport = love.image.newImageData(love.window.width, love.window.height);
end
I get the error "bad argument #1 to to newImageData(file, FileName or FileData expected)". I would like to know if this means that the feature was removed or there is a different syntax.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: 0.10.1: newImageData error

Post by bartbes »

It wasn't, the problem is that love.window.width is a nil value, so it can't detect which variant it should use, hence the slightly confusing error message. Try love.window.getWidth() (and love.window.getHeight()). Or, more concisely, love.window.getDimensions().
Gip-Gip
Prole
Posts: 2
Joined: Sun Aug 14, 2016 3:35 am

Re: 0.10.1: newImageData error

Post by Gip-Gip »

Thanks! Since 0.10.0 you would call love.graphics.getDimensions() instead.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests