Thread: Module.getModuleInfo()
-
July 20th, 2018, 16:31 #1
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Module.getModuleInfo()
There appears to be a problem with the wiki documentation on this api because there is this code in the utility_library.xml file:
Code:<windowclass name="library_booklistentry"> <margins control="0,0,0,7" /> <sizelimits> <minimum height="70" /> </sizelimits> <script> function onInit() local sModule = getDatabaseNode().getModule(); local info = Module.getModuleInfo(sModule); name.setValue(info.displayname or info.name); thumbnail.setIcon("module_" .. sModule); end
function getModuleInfo( name )Note there is no returned field for displayname.
This function can be used to retrieve information about a particular module. The returned table contains information in the following fields:
name
category
author
size
installed (on local machine)
loaded
loading (from host machine)
loadpending (active request to host machine)
permission (none, disallow, allow, autoload)
intact (host only)
replaces (which other modules does this one override)
hastokens
hasdata
Parameters
name (string)
The name of the module being targeted by the operation
Return values
(table)
A table containing information about the module, see above for details
But this also raises two questions:
- 1. What is the difference in name, displayname, and the string parameter you pass to getModuleInfo to obtain the module record?
- 2. Why did the icon get set to "module_" and the sModule variable? Wouldn't the icon field of the record have returned the icon name?
Last edited by Bidmaron; July 20th, 2018 at 16:36.
-
July 20th, 2018, 21:22 #2
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
OK, I went in and did some exploring, and it appears that displayname is the only undocumented field. And, of course, there is no icon field, so disregard question #2.
I have over 200 modules, and it would seem that, at least for the ones I own, the name used to look up the module with getModuleInfo, the field called 'name,' and the field called 'displayname' are identical for all the modules I own.Last edited by Bidmaron; July 20th, 2018 at 21:46.
-
July 21st, 2018, 01:40 #3
<displayname> was added a few updates ago. It goes in definition.xml so you can have the Library page show something other than what the <name> value is. (Note: so far, displayname only works in the Library. All the campaign windows group names will still show the name.)
It was primarily added because @Moon Wizard finally got irritated enough at the 5E DLC saying "DD Player's Handbook" etc. because the original developer apparently didn't know how to use ASCII codes. So now the <displayname> shows "D&D Player's Handbook" in the Library, while the <name> is still "DD Player's Handbook" to avoid breaking links in existing campaigns.
-
July 21st, 2018, 01:54 #4
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
All of what Talyn said is true.
Also, the “name” field is equal to the file name if undefined; and the display name is equal to the “name” field if undefined.
Finally, the name field is used internally within FG as the unique key for accessing assets and data within modules.
Cheers,
JPG
-
July 21st, 2018, 01:55 #5
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Talyn, according to the code in 3.5.5, it should be showing the displayname if it is available. This is the code:
Code:function onInit() local sModule = getDatabaseNode().getModule(); local info = Module.getModuleInfo(sModule); name.setValue(info.displayname or info.name); thumbnail.setIcon("module_" .. sModule); end
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks