Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lua input.get() stops detecting keyboard keys #931

Closed
Warepire opened this issue Jul 22, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@Warepire
Copy link

commented Jul 22, 2017

Windows 7, BizHawk 2.1, NLua+KopiLua backend. Seen with PSX core.

Using input.get() to turn features on and off in a Lua script will eventually stop working after a random(?) amount of time. Meaning that pressing keys on the keyboard will no longer have the keys register as pressed in the dictionary provided by the input.get() function.

I made sure the keys are not used as hotkeys / input keys.

If I need to provide anything else, let me know.

@Warepire

This comment has been minimized.

Copy link
Author

commented Jul 22, 2017

I should add, nothing is open except the game and the Lua console, and the game has focus when this happens. Not recording a movie either.

@Warepire

This comment has been minimized.

Copy link
Author

commented Jul 22, 2017

Simple test script:

while true do
	local keysToCheck = {"J", "K", "L"}
	local keys = input.get()

	for i, v in ipairs(keysToCheck) do
		if keys[v] == true and keysPrev[v] ~= true then
			console.log(string.format("key %s pressed!", v))
		end
	end

	keysPrev = input.get()
	emu.frameadvance()
end
@zeromus

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2017

Just committed what should be a fix for this. Part of the "luainterface and nlua never supported coroutines so we had to do it ourselves" mastertask which I have not noticed needed doing for years.

Fixed it in luainterface too -- it might have been the cause of the crashes. Or it might just make things worse.

@Warepire

This comment has been minimized.

Copy link
Author

commented Jul 23, 2017

Tested NLua+KopiLua on the latest master, I can no longer trigger this problem. Thanks!

@zeromus zeromus closed this Jul 23, 2017

@YoshiRulz YoshiRulz added the Topic-Lua label Feb 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.