Page 1 of 1
main.lua:7: attempt to perform arithmetic on field 'getWidth' (a function value)
Posted: Mon Jan 29, 2018 3:47 pm
by dawdejw
So, when i was making a game (well, a program anyway), this lovely message popped up:
Code: Select all
main.lua:7: attempt to perform arithmetic on field 'getWidth' (a function value)
This, is the line in question:
Code: Select all
scale = love.graphics.getWidth / 320
I don't know, am I dumb or what, but I couldn't find more about this error, so I'm asking - what the heck is wrong with this line? All I want to do is a simple division - to divide window width by 320, and I can't see anything wrong with that line. Also, I don't know should I post .love or not, but I'll include it anyway.
Re: main.lua:7: attempt to perform arithmetic on field 'getWidth' (a function value)
Posted: Mon Jan 29, 2018 3:50 pm
by Ulydev
dawdejw wrote: ↑Mon Jan 29, 2018 3:47 pm
So, when i was making a game (well, a program anyway), this lovely message popped up:
Code: Select all
main.lua:7: attempt to perform arithmetic on field 'getWidth' (a function value)
This, is the line in question:
Code: Select all
scale = love.graphics.getWidth / 320
I don't know, am I dumb or what, but I couldn't find more about this error, so I'm asking - what the heck is wrong with this line? All I want to do is a simple division - to divide window width by 320, and I can't see anything wrong with that line. Also, I don't know should I post .love or not, but I'll include it anyway.
love.graphics.getWidth is a function. You need to call it to retrieve a value.
Re: main.lua:7: attempt to perform arithmetic on field 'getWidth' (a function value)
Posted: Mon Jan 29, 2018 3:55 pm
by dawdejw
Ulydev wrote: ↑Mon Jan 29, 2018 3:50 pm
dawdejw wrote: ↑Mon Jan 29, 2018 3:47 pm
So, when i was making a game (well, a program anyway), this lovely message popped up:
Code: Select all
main.lua:7: attempt to perform arithmetic on field 'getWidth' (a function value)
This, is the line in question:
Code: Select all
scale = love.graphics.getWidth / 320
I don't know, am I dumb or what, but I couldn't find more about this error, so I'm asking - what the heck is wrong with this line? All I want to do is a simple division - to divide window width by 320, and I can't see anything wrong with that line. Also, I don't know should I post .love or not, but I'll include it anyway.
love.graphics.getWidth is a function. You need to call it to retrieve a value.
OHH, I see, Thank you very much, I didn't know it makes a diffrence!