ToME: the Tales of Maj'Eyal

Everything about ToME
It is currently Wed May 27, 2020 10:43 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Apr 03, 2014 6:58 pm 
Offline
Wyrmic

Joined: Tue Feb 15, 2011 12:01 am
Posts: 282
This is a compatibility issue I'm wrestling with in the current moment. To clarify this topic's title, a file loaded by "require" in one addon's hooks/load.lua file breaks superloading of the same file in the other addon.

in addon1's hooks/load.lua:
Code:
require "engine.interface.ActorProject"

in addon2's superload/load.lua (my addon, in this case):
Code:
local _M = loadPrevious(...)

local base_project = _M.project

function _M:project(
    --do_something
    return base_project(self, params)
end)

return _M

This occurs when both addons are given the same weighting, or in any case when the file-requiring adding loads before the superloading addon. Of course, it can be fixed by setting the other creator's addon to load after my superloaded function has been defined, but not only is this messy, it doesn't stop similar complications from arising. Other files are very often required by the hooks/load.lua file, and it'll be a continual matter of luck whether my load.lua file happens to reference functions superloaded in an addon that now loads before mine.

What's the best way to handle this? Does something need fixing? Or have I missed something glaringly obvious?

I'll spend some time sifting through the addon-loading code, but don't have time to for the minute. In the meantime, thank you for any clues you can throw my way!


Top
 Profile  
 
PostPosted: Thu Apr 03, 2014 7:57 pm 
Offline
Wyrmic

Joined: Tue Feb 15, 2011 12:01 am
Posts: 282
I think this relates to a bug mentioned in a previous post by the ever-brilliant Hackem_Muche:

viewtopic.php?p=161531#p161567

Am I on the right track?

edit: The problem has been investigated and I have proposed a fix! :)

viewtopic.php?f=42&t=41009&p=177400#p177400


Top
 Profile  
 
PostPosted: Sat Apr 19, 2014 6:17 pm 
Offline
Uruivellas

Joined: Wed Apr 30, 2008 5:55 pm
Posts: 708
I believe this was fixed in 1.2, or there exists a fix, or something? In any case, I found a workaround to the problem for those of us on 1.1.5:
Code:
-- Require the file you need.
local combat = require 'mod.class.interface.Combat'
-- Do whatever you want to it.
combat.grayswandir_test_value = true
-- Mark the file as not having been required.
package.loaded['mod.class.interface.Combat'] = nil

I made a very simple addon composed of just this and it worked really well. Without that last line nulltweaks mastery changes wouldn't show up. With it, they show up and so does grayswandir_test_value.

I also tried sticking that last line at the start of nulltweaks's hooks/load.lua and that worked too. So you can defensively mark all of the files you've superloaded as not having been loaded in your own addons.

_________________
Addons: Arcane Blade Tweaks, Fallen Race, Monk Class, Weapons Pack
Currently working on Elementals. It's a big project, so any help would be appreciated. :)


Top
 Profile  
 
PostPosted: Sat Apr 19, 2014 9:37 pm 
Offline
Sher'Tul Godslayer

Joined: Tue Jun 18, 2013 10:46 pm
Posts: 2402
Location: Ambush!
grayswandir wrote:
I also tried sticking that last line at the start of nulltweaks's hooks/load.lua and that worked too. So you can defensively mark all of the files you've superloaded as not having been loaded in your own addons.
That's awesome. I'll put that in my stuff going forward.

_________________
Check out my addons: Nullpack (classes), Null Tweaks (items & talents), and New Gems fork.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group