One flipbook animation after another

I’m sorry but what is the function()? I’m new and I do not understand.
This is my code right now.

function on_input(self, action_id, action)
	--flipbook animation
	if action_id == hash("right") and action.pressed then
		sprite.play_flipbook("#sprite", "walk")
		self.right = true
		self.left = false
	elseif action_id == hash("left") and action.pressed then
		sprite.play_flipbook("#sprite", "walk")
		self.left= true
		self.right=false
	elseif action_id == hash("touch") and action.pressed then
		ssprite.play_flipbook("#sprite","attack",function()
			sprite.play_flipbook("sprite","idle")
		end)
	end