Wir haben festgestellt, dass Euer Browser keine Cookies akzeptiert. Bitte erlaubt die Verwendung von Cookies in den Optionen Eures Browsers, um eine optimale Funktion dieser Webseite zu gewährleisten.
Ergebnis 1 bis 3 von 3
  1. #1
    Registriert seit

    The re-load trick (Moormap etc) ... having trouble

    Okay, so I've got the helper plugin set up to reload. I can invoke it from within my 'main' plugin; it is successfully called and runs.

    What does *not* appear to be happening is that my main plugins isn't receiving an 'unload' directive.

    I've got a WriteLine command in my Unload() function which __isn't called__ when the re-loader runs, so I can be certain that the plugin's Unload() command isn't being invoked.

    Here is my loader plugin's code, which is based on the MoorMapLoader code:
    function PluginLoader:Constructor()
    	self.pluginName = plugin:GetName();
    		if (Plugins[self.pluginName] ~= nil) and (not self.loaded) then
    			local parentName = string.gsub (self.pluginName, "Loader$", "");
    Turbine.Shell.WriteLine ("Reloading "..parentName);			
    A few slight changes:
    -- I've based it on Control (which also gets updates) rather than window, since window is a child object of control, and uses up more data/memory.

    -- I've generalized this code [so it can be reused without change in any plugin] by pulling the reloading plugin's name from the environment at loading-time, then assuming that a plugin called <Name>Loader is the reloader plugin for a plugin called <Name>. This works - the debugging WriteLine call shows it has deduced 'parentName' properly. Also, for debugging, I tried replacing 'parentName' in those calls with the explicit 'main' plugin name, and the behavior remained the same.

    So I'm a bit baffled.

    I thought all that was required to force the PluginManager to unload and then reload a plugin was those two calls:
    Turbine.PluginManager.UnloadSc riptState(parentName);
    Turbine.PluginManager.LoadPlug in(parentName);
    And I know that the Reloader makes it into that block of code, and that it accurately computes parentName.

    And yet, that parent plugin isn't getting unloaded.

    The upshot is that my main plugin correctly puts itself into the "i'm about to be reloaded" state, and successfully calls the reloader... and then doesn't get reloaded!

    If I manually unload (/plugins unload all) and then reload my main plugin, it reloads in the "I'm being reloaded" state and behaves appropriately.

    So everything seems to be working *except* that the Loader plugin, though successfully invoked, does not unload/reload my main plugin!


  2. #2
    Registriert seit
    First, a small clarification. You don't unload a Plugin, you unload a ScriptState which is an entire environment that includes one or more plugins. Turbine's Lua allows multiple copies of the Lua environment. A plugin normally runs in the default environment but can be loaded into a distinct copy by defining the "Apartment" property of the "Configuration" tag in the .plugin file. So, to be unloaded programmatically, the plugin should have it's own apartment and that is the name that is passed to the UnloadScriptState method. I'm not sure, but it's likely that you are trying to unload the plugin rather than it's apartment. There is a more detailed description in the Party Sample post in the Writing LotRO Lua Plugins for Noobs thread:

  3. #3
    Registriert seit


    ah... that was it, after a fashion.

    The plugin and apartment had the same name ... or would have, if there hadn't been a subtle typo in the apartment name. Meaning it couldn't find the apartment to unload, since I was apparently too dense to type in the name properly.


    ... on to discover my next lu-bie troubles ...




  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein

Diese Formular-Sitzung ist abgelaufen. Du musst die Seite neu laden.

Neu laden