Jump to content

Script:Delete() vs Script:Detach()


thehankinator
 Share

Recommended Posts

Is this a typo? If not, Delete() appears not to be called when the script is removed from the object, under what conditions does an object have a script removed but not deleted?

 

http://www.leadwerks.com/werkspace/page/api-reference/_/script-reference/

Script:Delete()

This function is called when the entity it is attached to is deleted from memory. Use this to release any resources you allocated in the Script:Start() function.

 

 

http://www.leadwerks.com/werkspace/page/tutorials/_/lua-scripting-r12

Script:Detach()

This function will be called when the script is removed from the object, or if the object is deleted.

Link to comment
Share on other sites

Script::Delete() is from the LE3.0 days and has been 'replaced' with Script::Release(). Everything in LE should be released and the engine will take care of the rest.

 

I never used Detach personally so I can't tell you what it'd be good for.

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Script::Delete() is from the LE3.0 days and has been 'replaced' with Script::Release(). Everything in LE should be released and the engine will take care of the rest.

 

I never used Detach personally so I can't tell you what it'd be good for.

So neither the tutorial or the reference pages are correct? Do you know where Script:Release() is documented? I don't see it on either page.

Link to comment
Share on other sites

That's for Object:Release(), the documentation I am looking for defines the the behavior of Script:Release() if it exists in a script that is attached to an entity. Similar to Script:Start(), Script:UpdateWorld(), etc. The links in OP have Script:Detach() or Script:Delete() but nothing about Script:Release() which Reep says superseded Script:Detach() and/or Script:Delete() but the tutorial and reference do not match (one has Script:Detach() the other Script:Delete()) and neither have Script:Release() defined.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...