# Changes in spine.play callback (SOLVED)

**URL:** <https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912>\
**Category:** Bugs\
**Created:** [September 13, 2016, 6:46pm UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912 "2016-09-13T18:46:57Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [September 13, 2016, 6:46pm UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/1 "2016-09-13T18:46:57Z")

</div>

As I understood in defold 1.2.88 you change spine callback.  
And now callback has all parameters like on\_message and can has different message\_id.  
And, one more important that callback can be call not only when animation ended and by spine events too.

Am I right?

I can’t find information about this changes in [docs](http://www.defold.com/ref/spine/#spine.play:url-animation_id-playback-blend_duration--complete_function-) but this changes broke my project animations(

example of new callback

```lua
local function callback_example(self, message_id, message, sender)
	print(message_id)
	pprint( message)
	print(sender)
end

spine.play("#spinemodel", "idle_var1",go.PLAYBACK_ONCE_FORWARD, 0.1, callback_example)

```

print:

```lua
DEBUG:SCRIPT: type	hash: [spine_animation_done]
DEBUG:SCRIPT: 
{
  animation_id = hash: [idle_var1],
  playback = 1,
}

DEBUG:SCRIPT: url: [game:/instance158#spinemodel]

```

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [September 13, 2016, 7:15pm UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/2 "2016-09-13T19:15:18Z")

</div>

Good question! @sven should know more about it I think. @sicher is the documentation lagging behind on this?

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [September 13, 2016, 7:22pm UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/3 "2016-09-13T19:22:32Z")

</div>

I have few more bugs with it (

when I try to ignore events by return

```lua
	if message_id == cfg.A_SPINE_EVENT then
	return

```

I receive strange bug message

```lua
ERROR:SCRIPT: attempt to call a userdata value
stack traceback:
ERROR:SCRIPT: attempt to call a nil value
stack traceback:

```

and then, sometimes app crashed. (gui.cpp - I have no code manipulations with gui in this moment)

```lua
Assertion failed: (lua_isfunction(L, -1)), function RunScript, file ../src/gui.cpp, line 1280.

```

---

<div class="post-metadata">

**Author:** ![sven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sven/32/1086_2.png) [@sven](https://forum.defold.com/u/sven)\
**Post date:** [September 14, 2016, 7:03am UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/4 "2016-09-14T07:03:41Z")

</div>

Thanks for reporting this, I’m looking into it!  
There should not have been any changes to the function signature of the callback, at least not by design. 🙂

**Update:** Tracked down the error, turns out this was a bug introduced in the latest release, related to the internal changes of our spine runtime. Many thanks to @AGulev for reporting this!

@AGulev: Regarding your initial question about the callback function parameter list… The function signature has not changed, but it was/is not described correctly in the documentation. Due to the way the callback is triggered internally (by using the message passing system) means you will actually get the same parameters as if it was triggered through `on_message`, and as you pointed out it will be; `callback(self, message_id, message, sender)`. 👍

---

<div class="post-metadata">

**Author:** ![AGulev](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/agulev/32/4541_2.png) [@AGulev](https://forum.defold.com/u/AGulev)\
**Post date:** [September 14, 2016, 9:11am UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/5 "2016-09-14T09:11:38Z")

</div>

What about spine\_event in callback? It’s a by desing in new defold version or it’s a bug?

---

<div class="post-metadata">

**Author:** ![sven](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sven/32/1086_2.png) [@sven](https://forum.defold.com/u/sven)\
**Post date:** [September 14, 2016, 9:19am UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/6 "2016-09-14T09:19:11Z")

</div>

That is a bug, and will be reverted to the previous behaviour in next release. (That is, spine\_event will only be sent to `on_message`).

---

<div class="post-metadata">

**Author:** ![sicher](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/sicher/32/8_2.png) [@sicher](https://forum.defold.com/u/sicher)\
**Post date:** [September 14, 2016, 7:26pm UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/7 "2016-09-14T19:26:26Z")

</div>

It it, I’ll make sure the docs cover it.

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [October 5, 2016, 7:27am UTC](https://forum.defold.com/t/changes-in-spine-play-callback-solved/2912/8 "2016-10-05T07:27:03Z")

</div>

Resolved in 1.2.89: [Defold 1.2.89 has been released](https://forum.defold.com/t/defold-1-2-89-has-been-released/3056)
