I have several addons that still use the old GetMapNameByID() API call. This is now a 'nil'.
I wrote a thin wrapper function that looks up the old worldID, converts it to the new style UiMapID, and returns C_Map.GetMapInfo(newid).name. The code works when I embed it directly into the various .lua files of the addon (but, that's not a great solution).
What I'm trying to do is create a new file, MapCompat.lua, in such a way that will allow the other pre-existing lua files in the addon to see the GetMapNameByID() call in that new .lua file.
Not having authored an addon before, there's a seemingly labyrinthine combination of .xml, .toc, etc, and I haven't quite hit on the right combination of things to do what I want to do.
No need to change or mess with any addons. If what you have works, just make a separate addon with the code and all addons will see it. You may have to name the addon with a ! in front to make sure it loads first. Those functions are global objects, so addons will see your change.
To make it even simpler, go to https://addon.bool.no, paste your code, and unzip it like any other addon.
Also, for future reference, if you want to pass information between modules (.lua files) within the same addon, each .lua file is "passed" two parameters, the name of the addon and a table that is exlcusive to that addon.
To use them, at the top of each file add
local addonName, addonTable = ...
the names can be anything you like.
You can create a function
Anywhere within your addon .lua files you can now call: