Search found 2 matches

by Oddnopp
Tue Apr 27, 2021 3:00 am
Forum: Support and Development
Topic: Require Help! - bad argument to pairs (table expected, got nil)
Replies: 4
Views: 5705

Re: Require Help! - bad argument to pairs (table expected, got nil)

I'm guessing you are scanning the list of projectiles when there is none. Change this: function love.update(dt) for k,v in pairs(projectile) do projectile[k].x = projectile[k].x + (speed * dt) end to this: function love.update(dt) if #projectile > 0 then for k,v in pairs(projectile) do projectile[k...
by Oddnopp
Mon Apr 26, 2021 5:31 am
Forum: Support and Development
Topic: Require Help! - bad argument to pairs (table expected, got nil)
Replies: 4
Views: 5705

Require Help! - bad argument to pairs (table expected, got nil)

ERROR MESSAGE: Error projectile.lua:14: bad argument #1 to 'pairs' (table expected, got nil) Traceback [C]: in function 'pairs' projectile.lua:14: in function 'update' [C]: in function 'xpcall' INTENTION: Trying to make a script that moves a projectile across the screen when I hit 'r' on my keyboar...