Bidmaron
July 20th, 2018, 16:31
There appears to be a problem with the wiki documentation on this api because there is this code in the utility_library.xml file:
<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
The getModuleInfo api says the following:
function getModuleInfo( name )
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
Note there is no returned field for displayname.
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?
<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
The getModuleInfo api says the following:
function getModuleInfo( name )
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
Note there is no returned field for displayname.
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?