Cuberite Forum
Entity.Destroy() crash - Printable Version

+- Cuberite Forum (https://forum.cuberite.org)
+-- Forum: Plugins (https://forum.cuberite.org/forum-1.html)
+--- Forum: Plugin Discussion (https://forum.cuberite.org/forum-8.html)
+--- Thread: Entity.Destroy() crash (/thread-2961.html)



Entity.Destroy() crash - nrgjrteherh435 - 05-24-2017

For whatever reason, When I use this function cuberite crashes:

[Image: SmvQwhz.png]

Cuberite crashes on launch. I thought this would be a simple task... Any help would be greatly appreciated!  Huh

EDIT:
I fixed it by calling HOOK_SPAWNING_ENTITY instead of HOOK_SPAWNED_ENTITY and doing this:
[Image: SSfWNtW.png]

But there's still no merit for a crash from the former method.


RE: Entity.Destroy() crash - xoft - 05-24-2017

True, Cuberite should not crash. But your code is very flawed. Note that all the Lua API functions use the "object" calling convention in Lua, which means you need to use colons instead of dots: Entity:IsExpOrb(); Entity:Destroy()


RE: Entity.Destroy() crash - NiLSPACE - 05-24-2017

Perhaps it crashes because the entity is not added to the world yet while cEntity:Destroy() tries to remove it?