Trouble with global ply and calling the function

x = 0

function superJump(ply)
if ply:KeyDown(IN_DUCK) then
repeat
x = x+10
until ply:KeyReleased(IN_DUCK)
end
end

while x == 0 do
repeat
superJump()
until x == 10
print(x)
end

[ERROR] lua/super_jump.lua:4: attempt to index local ‘ply’ (a nil value)

  1. superJump - lua/super_jump.lua:4
  2. unknown - lua/super_jump.lua:13

When you call superJump() on line 13, make sure to pass a player as the first argument.