library.getContents: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
m (Conversion script moved page Library.getContents to library.getContents: Converting page titles to lowercase)
No edit summary
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{MacroFunction
{{MacroFunction
|name=library.getContents
|name=library.getContents
|proposed=true
|proposed=false
|trusted=true
|trusted=true
|version=1.11.0
|version=1.11.0
Line 19: Line 19:
Get content information for the specified library.
Get content information for the specified library.
<syntaxhighlight lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
<pre>[r: json.indent(library.getContents("net.rptools.addon.some-lib"),2)]</pre>
<pre>
[r: json.indent(library.getContents("net.rptools.addon.some-lib"),2)]
</pre>
</syntaxhighlight>
</syntaxhighlight>
Returns:
Returns:
Line 48: Line 50:
}}
}}
[[Category:Library Function]]
[[Category:Library Function]]
[[Category:Add-on Library Functions]]

Latest revision as of 03:24, 17 April 2024

library.getContents() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.11.0
Retrieves a list of the content in the specified Add-On library. Information is returned as a JSON array.
  • For .mtlib Add-On libraries this will include a list of all MTScript, HTML, JavaScript and CSS files,
  • For lib:token Add-On libraries this will include a list of all macros and all defined Token Properties.

Usage

library.getContents(namespace)

Parameters

  • namespace - Namespace for the library.

Example

Get content information for the specified library.
<pre>
[r: json.indent(library.getContents("net.rptools.addon.some-lib"),2)]
</pre>

Returns: Output from a .mtlib library:

[
  "mtscript/public/auto_exec.mts",
  "mtscript/public/test1.mts",
  "public/test2.html",
  "mtscript/priv1.mts",
  "mtscript/public/test2.mts",
  "public/test1.html",
  "mtscript/public/CSSTest.mts",
  "mtscript/public/call_priv1.mts",
  "public/test-img.png",
  "mtscript/public/no_auto_exec.mts",
  "public/test1.css",
  "public/test1.js",
  "mtscript/public/myUDF.mts"
]

See Also

Version Changes

  • 1.11.0 - Function added