Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this.
-
unixfreak
- Citizen
- Posts: 79
- Joined: Thu Oct 15, 2015 6:25 am
- Location: Bristol, UK
-
Contact:
Post
by unixfreak » Mon Aug 06, 2018 12:18 am
Can anyone explain why this doesn't work?
Code: Select all
function love.keypressed(key)
if console.active then
console:keypressed(key)
return -- <---should exit function here
end
player:keypressed(key)
--[[
other code etc.... than should only be run when console.active = false
--]]
end
The problem is that the line with "return", should exit the function, and not process any other code when triggered. But even if
console.active = true, then everything else gets run afterwards.
Last edited by
unixfreak on Mon Aug 06, 2018 12:23 am, edited 1 time in total.
-
unixfreak
- Citizen
- Posts: 79
- Joined: Thu Oct 15, 2015 6:25 am
- Location: Bristol, UK
-
Contact:
Post
by unixfreak » Mon Aug 06, 2018 12:23 am
Derp. Ignore this post... i had some keypress input that was placed in some update() functions... hence they were triggering keypresses outside of the love.keypressed() function...
I ended up wrapping the keyboard related code in a block like:
Code: Select all
if not console.active then
-- blah blah
end
Solved!
Users browsing this forum: Bing [Bot] and 44 guests