Problem launching project

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
DropDead
Prole
Posts: 1
Joined: Wed Mar 17, 2021 1:36 pm

Problem launching project

Post by DropDead »

Hello !

I'm new on LÖVE, I just started using it for my online courses. I'm trying to seek help here please, I'm pretty sure the solution to my probleme is pretty dumb but like I said, I just began using it and I'm not acquainted with it yet. So here's the code I'm trying to launch :

Code: Select all

         -- Ligne de code pour check le debug--- 
io.stdout:setvbuf('no')
  
local Lander = {} 
Lander.x = 0
Lander.y = 0
Lander.angle = -90
Lander.vx = 0 
Lander.vy = 0
Lander.img = love.graphics.newImage("images/ship.png")

function love.load()
  largeur = love.graphics.getWidth()
  hauteur = love.graphics.getHeight()
  
  Lander.x = largeur/2
  Lander.y = hauteur/2
end 

function load.update(dt) 
 
end

function load.draw()
  love.graphics.draw(Lander.img, Lander.x, Lander.y, math.rad(Lander.angle), 1, 1, Lander.img:getWidth()/2, Lander.img:getHeight()/2)
end 
But when I try to launch the project I get this error
Error

main.lua:20: attempt to index global 'load' (a function value)


Traceback

main.lua:20: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
Which I actually dont really understand. I'd be grateful for some help :nyu:
MrFariator
Party member
Posts: 512
Joined: Wed Oct 05, 2016 11:53 am

Re: Problem launching project

Post by MrFariator »

You have written "load.update(dt)", where I presume you meant to write "love.update(dt)" instead. Same goes for "load.draw()". The error arises from your attempt to effectively index load like it is a table, even though it's a function value, hence the error.
Post Reply

Who is online

Users browsing this forum: No registered users and 199 guests