Sorry for the delay responding. I am not saying to do this (pseudocode): package.loaded = clone_table(originalPackageLoaded)
Rather, I am suggesting this (pseudocode): clear_all_subkeys(package.loaded) merge_into_from(package.loaded, originalPackageLoaded) The first way would break identity with registry value _LOADED. The second would not.* Referencing it through package.loaded is the right way because it is the documented way. The use of _LOADED in the registry is an undocumented implementation detail which might change. Cheers, Bruce * This assumes we're only making a shallow copy of the global namespace, so the original package.loaded and the new package.loaded refer to the same instance. I believe that is the case; it was my intention at least. If it is not working that way, I would call it a bug or at least a misfeature. > When I orignally rewrote the extension I came upon this problem. I tried > doing it the way you suggest but it didn't work. Lua's package table in > GLOBALSINDEX points to the table contained in REGISTRYINDEX (thus > reflecting its contents). Lua still uses the values in REGISTRYINDEX > however, regardless of what is in GLOBALSINDEX. We clear GLOBALSINDEX and > recreate it with the initial state, but package.loaded is unchanged in > REGISTRYINDEX. I found this out when I looked at Lua's source code. That > is why I find it necessary to modify the value in REGISTRYINDEX. > > Is there any particular reason why this needs to be changed? > > Take care, > -Mitchell; > > > > > I can implement this if no one else wants to. However, as > > you guys have probably noticed I don't exactly have a lot of > > time to devote to SciTE lately, so I will wait and see if > > someone else wants to give it a go first. _______________________________________________ Scite-interest mailing list [email protected] http://mailman.lyra.org/mailman/listinfo/scite-interest
