This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
private_addon_developer_help [2016/12/01 13:15] – fxfire | private_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. |
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. |
Example: | Example: | ||
Line 55: | Line 55: | ||
Get all files inside the " | Get all files inside the " | ||
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 " | Get all files inside the " | ||
local filelist = modexample.ModuleFunctions.GetModuleFiles(" | local filelist = modexample.ModuleFunctions.GetModuleFiles(" | ||
+ | |||
+ | |||
+ | ===== 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, | ||
+ | Where ' | ||
+ | |||
+ | Lua code of the sharing addon: | ||
+ | local testtable = {} | ||
+ | testtable.Text = " | ||
+ | function testtable.Function() | ||
+ | d(" | ||
+ | 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(" | ||
+ | end | ||
+ | if (testtable ~= nil) then | ||
+ | d(testtable) | ||
+ | testtable.Function() | ||
+ | else | ||
+ | d(" | ||
+ | end | ||
+ | end | ||
+ | |||
+ | |||