We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 25 of 59

Threaded View

  1. #32
    Join Date
    Mar 2007
    Posts
    1,590

    Re: The Unload Event Handler

    Quote Originally Posted by Astleigh View Post
    How did you find out about the Plugins[] element? I couldn't find it documented anywhere.

    What I was doing before was something like:
    Code:
    function Turbine.Plugin:Unload()
       -- save plugin state
    end
    I don't think you were actually clobbering anyone else's unload handlers. After a bit of testing with two plugins in the same apartment, one using Plugins[].Unload to assign its event handler and the other using Turbine.Plugin.Unload to assign its event handler it appears that the Turbine.Plugin object refers only to your plugin instance so each plugin gets a distinct instance of the Turbine.Plugin object. That is, assigning Turbine.Plugins.Unload in plugin "A" is the same as assigning Plugins["A"].Unload and will not overwrite the Unload handler for Plugins["B"]. Of course, this may be something that was changed with the latest updates and may have functioned differently before.

    I really don't remember where I learned about the Plugins[] table. It may have been from one of the beta forum threads before Lua was released or it may have been from one of the plugins that I dissected while learning Lua myself. Now that I looked for it, I agree that it doesn't seem to be documented anywhere.
    Last edited by Garan; Jan 17 2012 at 10:42 AM.

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload