Android Back Button

Strange. I’m doing something similar, but am mapping both “Back” and “Esc” to the action id. I think Android should only need that “Back” mapped, though.

Simplified code here from my project.

local BACK_BUTTON = hash("back_button")

function on_input(self, action_id, action)
	if action_id == BACK_BUTTON and action.pressed then
		sys.exit(0)
		return true
	end
end

On a side note, I think the best-practice to exit is calling sys.exit(0), instead of that message.

4 Likes