Hi folks, I have been trying to move my xna input checks into Lua. It has worked for the most part but strangely while the speed is fine in C# when I move the script to Lua, the keyboard input seems to have a bug in it where it lags before responding. If I just press and release the Space key nothing comes in my output windows but it works if i hold it down for about 2-3 seconds and release it. This bug does not occur with mouse input. I don't know why.
Here is is my script which is run from a DoFile in my XNA Update loop.
if (gameController.inputController:Pressed(Keys.Space)) then Console.WriteLine("pressed"); if (mainMenu.cursorState == "look") then mainMenu.cursorState = "talk"; Console.WriteLine(mainMenu.cursorState); else mainMenu.cursorState = "look"; Console.WriteLine(mainMenu.cursorState); end end
the Pressed function is used to just check the previous KeyboardState and the current Keyboard state so that we know the key has been pressed and released instead of just being pressed.