Search found 2 matches
- Fri Apr 07, 2017 11:23 pm
- Forum: Support and Development
- Topic: [Help] attempt to perform arithmetic on a table value
- Replies: 2
- Views: 4173
Re: [Help] attempt to perform arithmetic on a table value
newRec creates and returns a table, so all values for all indices of objects is a table; print(objects[ i ]+1) <-- is the line that errors objects[ i ] is a table, and you can't add a number to a table, as the error says. ey thank you. I just noticed what I did wrong. I did it right in some places ...
- Fri Apr 07, 2017 10:21 pm
- Forum: Support and Development
- Topic: [Help] attempt to perform arithmetic on a table value
- Replies: 2
- Views: 4173
[Help] attempt to perform arithmetic on a table value
It seems to error on line 22 in function draw. function love.load(arg) gr = love.graphics total = 0 objects = {} amount = 0 end function love.update(dt) total = total + dt for i = 1, #objects do v = objects[i] v.x = v.x + v.speed * dt v.h = math.max(5,v.h + math.sin(total)) v.w = math.max(5,v.w + ma...