Passing more parameter to "complete_function" in "gui.animation" (SOLVED)

Hi,
I have an example:

local function delete_node_after_anim(self, node, count)
	gui.delete_node(node)
    if count == 4 then
    --all animation is finished
    end
end

and

gui.animate(node, gui.PROP_SCALE, scale, gui.EASING_LINEAR, duration, 0, delete_node_after_anim)

–> How can I pass parameter “count” to function “delete_node_after_anim”

Thanks

1 Like

Maybe something like this

gui.animate(node, gui.PROP_SCALE, scale, gui.EASING_LINEAR, duration, 0, function() 
    delete_node_after_anim(count) 
end)
2 Likes

If you have count as a property on self (self.count) you can access it in the function. Self is always passed as an argument to the complete function.

function delete_node_after_anim(self)
   --use self.count
end
2 Likes

Thank you Mattias_Hedberg.

1 Like

Thank you Johan, I got it.

1 Like