User Tools

Site Tools



private_addon_developer_help

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
private_addon_developer_help [2020/06/15 07:07] hanswprivate_addon_developer_help [2020/12/02 13:29] (current) fxfire
Line 87: Line 87:
 Get all files inside the "data" subfolder of your module: Get all files inside the "data" subfolder of your module:
             local filelist = modexample.ModuleFunctions.GetModuleFiles("data");             local filelist = modexample.ModuleFunctions.GetModuleFiles("data");
 +
 +
 +===== Sharing Data between private Addons =====
 +
 +The addon that shares data:
 +To allow access of other addons to the shared data, add this line to the .def file of the addon which shares the data:
 + SharedAccess=2948FB2D-0228-11EB-A373-52540012300A,2D980E1F-4729-11EA-BD7E-52540012300A
 +Where '2948FB2D-0228-11EB-A373-52540012300A' and '2D980E1F-4729-11EA-BD7E-52540012300A' are two private addon uuids, which are then able to access the shared data.
 +
 +Lua code of the sharing addon:
 +            local testtable = {}
 +            testtable.Text = "private text"
 +            function testtable.Function() 
 +                d("called shared function")
 +            end
 +            local modulefunctions = GetPrivateModuleFunctions()
 +            if (modulefunctions ~= nil ) then
 +             if( modulefunctions.SetPrivateModuleTable ~= nil) then
 +                    res = modulefunctions.SetPrivateModuleTable(testtable)
 +             end
 +            end
 +            
 +            
 +To access the shared data from the allowed addons:
 +            local modulefunctions = GetPrivateModuleFunctions()
 +            if (modulefunctions ~= nil) then
 +             if( modulefunctions.GetPrivateModuleTable ~= nil) then
 +             testtable = modulefunctions.GetPrivateModuleTable("0E964E39-0228-11EB-A373-52540012300A" -- This is the addon UUID of the addon which shares the data!
 +             end
 +             if (testtable ~= nil) then
 +             d(testtable)
 +             testtable.Function()
 +             else
 +             d("failed to get shared table")
 +             end
 +            end
 +
 +
  
private_addon_developer_help.1592204836.txt.gz · Last modified: 2020/06/15 07:07 by hansw