input.IsKeyDown() thinking its a table?

So I’m trying to make a code that makes something based on player input. So key_num_1 will make 25 health add. Then a cooldown happens. Now input.IsKeyDown() with the argument key_num_1, or its counterpart 38 return an error.



[ERROR] addons/abilities/lua/autorun/client/cl_abilities.lua:14: calling 'IsKeyDown' on bad self (number expected, got table)
  1. IsKeyDown - [C]:-1
   2. v - addons/abilities/lua/autorun/client/cl_abilities.lua:14
    3. unknown - lua/includes/modules/hook.lua:82



number expected got table? WTF?! 38 is NOT a table gmod, go home your drunk. Please help! Here’s my code input.



hook.Add( "Think", "KeyDown_Test", function()

	if input:IsKeyDown(38) then
		//if ply:GetNWInt('LVL') >= 1 then
			if ability1_triggered == false then
				ply:SetMaxHealth(125)
				ply:SetHealth(ply:Health() + 25)
				ability1_timer = 1
				ability1_triggered = true
				Msg("health + 25")
			end
		//end
	end

end)


It’s because you’re basically doing input.IsKeyDown(input, 38) when calling input:IsKeyDown(38)

Ohk i tried changing it to input.IsKeyDown(38) instead of input:IsKeyDown(38) and it still doesn’t work… same error.

[editline]21st January 2014[/editline]

Got it working! Thanks facepunch!