library.getInfo: Difference between revisions
Jump to navigation
Jump to search
m (Turn off 'proposed') |
m (Added new Category tag) |
||
Line 10: | Line 10: | ||
|usage= | |usage= | ||
< | <source lang="mtmacro" line> | ||
library.getInfo(namespace) | library.getInfo(namespace) | ||
</ | </source> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|namespace|The namespace of the library.}} | {{param|namespace|The namespace of the library.}} | ||
Line 18: | Line 18: | ||
|example= | |example= | ||
Retrieves the info for the {{code|.mtlib}} library ''net.rptools.addon.some-lib''. | Retrieves the info for the {{code|.mtlib}} library ''net.rptools.addon.some-lib''. | ||
< | <source lang="mtmacro" line> | ||
<pre>[r: json.indent(library.getInfo("net.rptools.addon.some-lib"),2)]</pre> | <pre>[r: json.indent(library.getInfo("net.rptools.addon.some-lib"),2)]</pre> | ||
</ | </source> | ||
Returns: | Returns: | ||
< | <source lang="json"> | ||
[{ | [{ | ||
"name": "some-lib", | "name": "some-lib", | ||
Line 35: | Line 35: | ||
"allowsUrlAccess": true | "allowsUrlAccess": true | ||
}] | }] | ||
</ | </source> | ||
|also= | |also= | ||
{{func|library.getContents}}, {{func|library.listAddOnLibraries}}, {{func|library.listTokenLibraries}} | {{func|library.getContents}}, {{func|library.listAddOnLibraries}}, {{func|library.listTokenLibraries}} | ||
|changes= | |changes= | ||
* '''1.11.0''' - Function added | * '''1.11.0''' - Function added | ||
}} | }} | ||
[[Category:Library Function]] | [[Category:Library Function]] | ||
[[Category:Add-on Library Functions]] |
Revision as of 03:33, 11 February 2024
library.getInfo() Function
• Introduced in version 1.11.0
Retrieves various information about a loaded Add-On library. Information is returned as a JSON object.
- For
.mtlib
Add-On libraries this information comes from thelibrary.json
file inside of the.mtlib
file. Information is the same as that returned by library.listAddOnLibraries(). - For lib:token Add-On libraries this information comes from the Token Properties of the lib:token. Information is the same as that returned by library.listTokenLibraries().
Usage
library.getInfo(namespace)
Parameters
namespace
- The namespace of the library.
Example
Retrieves the info for the
.mtlib
library net.rptools.addon.some-lib.
<pre>[r: json.indent(library.getInfo("net.rptools.addon.some-lib"),2)]</pre>
Returns:
[{
"name": "some-lib",
"namespace": "net.rptools.addon.some-lib",
"version": "1.0.0",
"website": "www.rptools.net",
"gitUrl": "github.com/RPTools/maptool",
"authors": ["RPTools Team"],
"license": "GPL 3.0",
"description": "My new test library for stuff",
"shortDescription": "test library",
"allowsUrlAccess": true
}]
See Also
Version Changes
- 1.11.0 - Function added