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 [2016/12/01 13:15] fxfireprivate_addon_developer_help [2020/12/02 13:29] (current) fxfire
Line 14: Line 14:
 **CreateFolders**: **CreateFolders**:
 If you want to create subfolders on the local hdd to write logfiles or export files from inside your module, you can define a list of subfolders (single level) If you want to create subfolders on the local hdd to write logfiles or export files from inside your module, you can define a list of subfolders (single level)
-inside the .def file. Those folders will be created inside your modules local folder.+inside the .def file. Those folders will be created inside your modules local folder. FOLDER NAMES ARE CASE SENSITIVE!
  
 Example: Example:
Line 22: Line 22:
 If you have files inside your module that need to be accessible from the local hdd of the user, you can have them exported. Files will always be exported from the If you have files inside your module that need to be accessible from the local hdd of the user, you can have them exported. Files will always be exported from the
 folder you put them in and into the same local folder inside the module folder. You need to use the CreateFolders option to create any local folders or the export will fail. folder you put them in and into the same local folder inside the module folder. You need to use the CreateFolders option to create any local folders or the export will fail.
-Files will be overwritten when your module is loaded, so don't export files that the user should be able to edit. Files and folders can only contain alphanumerical letters.+Files will be overwritten when your module is loaded, so don't export files that the user should be able to edit. Files and folders can only contain alphanumerical letters. FOLDER NAMES ARE CASE SENSITIVE!
  
 Example: Example:
Line 55: Line 55:
  Get all files inside the "data" subfolder. The function returns a table containing table entries having the keys p,m and f, with p=folder,m=modulename,f=filename, for each file in the folder. A subfolder is NEEDED, you don't have access to the root of your addon folder.  Get all files inside the "data" subfolder. The function returns a table containing table entries having the keys p,m and f, with p=folder,m=modulename,f=filename, for each file in the folder. A subfolder is NEEDED, you don't have access to the root of your addon folder.
  Entries from this table can be passed to the ReadModuleFile function to load those files. The modulename is not used, you can only load files inside your own module.  Entries from this table can be passed to the ReadModuleFile function to load those files. The modulename is not used, you can only load files inside your own module.
 +        
 + CheckUserAddonOwnership({UUID}):
 +                Checks if the user owns the addon with that uuid. returns true or false. Your own addon uuids are displayed on the developer addon update page.
   
 Here is an example of how to declare a local module main table and use the private module functions to load a file from inside the module: Here is an example of how to declare a local module main table and use the private module functions to load a file from inside the module:
Line 84: 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.1480598133.txt.gz · Last modified: 2016/12/01 13:15 by fxfire