function love.load()
pic1 = love.graphics.newImage(pic1.bmp)
end
function love.draw()
love.graphics.draw(pic1, 50, 50, 0, 0, 0, 0, 0)
end
the above is my code but it just gives me this erro:
Error
main.lua.7 attempt to index global 'pic1' a nil value
Traceback:
manin.lua.7: in function 'load'
[C:] in function 'xpcall'
Loading Images
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- hatingcollege
- Prole
- Posts: 2
- Joined: Tue Mar 02, 2010 4:47 am
- Location: Virginia, USA
- Contact:
Re: Loading Images
On this line:
You're forgetting to enclose your strings with quotes. Lua thinks you're trying to access the bmp index of pic1 (as if it were a table).
Fix:
Code: Select all
pic1 = love.graphics.newImage(pic1.bmp)
Fix:
Code: Select all
pic1 = love.graphics.newImage('pic1.bmp')
Who is online
Users browsing this forum: Ahrefs [Bot] and 4 guests