I’m getting a joystick.lua:441: attempt to call global ‘post’ error when touching the virtual joystick. I’m using the virtual joystick created by Roaming Gamer.
At the top of my level1.lua file I have “local joystick = require(‘libs.joystick’)”, which is where my joystick.lua file is located. The error shows as soon as I touch the on screen joystick. Here’s the code that’s in my function scene:create() section pertaining to the touching of the joystick.
-- create a joystick on the screen joystick.create( group, 200, 200, { eventName = "myJoystickEvent", inUseAlpha = 1, notInUseAlpha = 0.05, useAlphaFadeTime = 250, outerStrokeColor = \_WHITE\_, outerAlpha = 0.5, stickRadius = 65 } ) joystickListener = function( event ) for k,v in ipairs( labelNames ) do print( event.vx ) print( event.vy ) print( event.nx ) print( event.percent ) print( event.phase ) print( event.state ) print( event.angle ) print( event.direction ) end end Runtime:addEventListener("myJoystickEvent", joystickListener)
What am I doing wrong?