1. Chris Klimas
  2. zoetrope
Issue #8 resolved

gamepad axis nil value error

Anonymous created an issue

numGamepads = 1 local gp = the.gamepads[1] self.square.velocity.x = gp.axes[1] * 400 self.square.velocity.y = gp.axes[2] * 400

when I try to use the axes values at the beginning of the programm for analog movement I get a nil value error

Crash, main.lua:28: attempt to perform arithmetic on field '?' (a nil value)

when I use the line from the demo

if the.keys:justPressed('m') then self.analog = not self.analog end

and use the axis only later in the game there is no problem.

I seems that the axis are nil on the start of the program

I also took the zoetrope_1.1.love file and changed the line 5 in the tests/gamepad.lua file to analog = true, so that it uses analog movement from the beginning and I get the same error.

Comments (5)

  1. Log in to comment