setIcon giving an 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
BananasGoMoo
Prole
Posts: 2
Joined: Fri Sep 02, 2011 2:13 am

setIcon giving an Error

Post by BananasGoMoo »

I try to add an icon to my test program and I get this error: "main.lua:2:Incorrect parameter type: expected userdata"

now I'm kinda new (ok, really new) to lua, and LOVE, but according to the wiki, I think I wrote this line correctly:

Code: Select all

love.graphics.setIcon("gfx/icon.png")
my .love file structure is: Image


can anyone explain what's wrong? ^^

PS: I know C++, so you don't need to simplify your explanation too much.
User avatar
slime
Solid Snayke
Posts: 3152
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: setIcon giving an Error

Post by slime »

I believe love.graphics.setIcon takes an image object rather than a string path to an image, so something like this:

Code: Select all

local icon = love.graphics.newImage("gfx/icon.png")
love.graphics.setIcon(icon)
Also, the wiki says that setIcon might not work on windows. :/
BananasGoMoo
Prole
Posts: 2
Joined: Fri Sep 02, 2011 2:13 am

Re: setIcon giving an Error

Post by BananasGoMoo »

Thanks! That worked.
:awesome:


EDIT: Dunno, it worked perfectly on mine (Win7 x64)
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: setIcon giving an Error

Post by T-Bone »

I didn't know there existed something like this. What icon this supposed to set? It can't possibly set the icon of the .love-file. It has to be the icon of the game while it's running, correct? Doesn't seem to work on Unity.

EDIT: Oh nevermind, it does :P Nice!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests