Page 1 of 1

setIcon giving an Error

Posted: Fri Sep 02, 2011 2:27 am
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.

Re: setIcon giving an Error

Posted: Fri Sep 02, 2011 2:29 am
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. :/

Re: setIcon giving an Error

Posted: Fri Sep 02, 2011 2:31 am
by BananasGoMoo
Thanks! That worked.
:awesome:


EDIT: Dunno, it worked perfectly on mine (Win7 x64)

Re: setIcon giving an Error

Posted: Mon Sep 05, 2011 12:49 pm
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!