Testing if a LCB Library or Widget is installed from LCS

LiveCode Builder is a language for extending LiveCode's capabilities, creating new object types as Widgets, and libraries that access lower-level APIs in OSes, applications, and DLLs.

Moderators: LCMark, LCfraser

Post Reply
PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Testing if a LCB Library or Widget is installed from LCS

Post by PaulDaMacMan » Wed May 09, 2018 6:11 pm

I know I saw the answer to this somewhere before, but I can't seem to find it now. How do you test if a certain Widget or LCB Library is installed from LiveCode script? And also how to check if it's a certain version of the target extension?

Thanks in Advance.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Testing if a LCB Library or Widget is installed from LCS

Post by PaulDaMacMan » Thu May 10, 2018 4:20 pm

I found it, you check the contents of the loadedExtensions.

Still not sure about how to check meta info, like the version number, of a loaded extensions. It seems like libs that come with LC have a functions that returns it's version.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

livecodeali
Livecode Staff Member
Livecode Staff Member
Posts: 192
Joined: Thu Apr 18, 2013 2:48 pm

Re: Testing if a LCB Library or Widget is installed from LCS

Post by livecodeali » Fri May 11, 2018 3:12 pm

In the IDE you can do

revIDEExtensions() to get an array with all the metdata. You can cut that down with parameters, eg revIDEExtensions("library") or revIDEExtensions("widget", "installed").

For individual extension properties, use
revIDEExtensionProperty(<kind>, <propName>)

where propName is various things, including:

"status", "name", "type_id", "author", "title", "svgicon", "version", "source_file", "source_type", "type", "uservisible", "support_files", "svgicon", ...

PaulDaMacMan
Posts: 616
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: Testing if a LCB Library or Widget is installed from LCS

Post by PaulDaMacMan » Sat May 12, 2018 1:40 am

livecodeali wrote:
Fri May 11, 2018 3:12 pm
In the IDE you can do

revIDEExtensions() to get an array with all the metdata. You can cut that down with parameters, eg revIDEExtensions("library") or revIDEExtensions("widget", "installed").

For individual extension properties, use
revIDEExtensionProperty(<kind>, <propName>)

where propName is various things, including:

"status", "name", "type_id", "author", "title", "svgicon", "version", "source_file", "source_type", "type", "uservisible", "support_files", "svgicon", ...
Thanks Ali! I should be able to get that to work for stacks that rely on a certain version of an extension being installed. I found I can include an extension module in the script of a stack by binary64 encoding, decode the binary into a variable and then load a module from that, so I was trying to be proactive, looking ahead to try to avoid possible conflicts with the same module or older version of it that could already be loaded in the IDE. I guess if I want to check the version in a standalone I'd have to sift through the handlers in revideextensionlibrary.livecodescript, where those handlers live (then again there probably wouldn't be much point to doing that in a standalone since the proper version of a module would be included at build time.)
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Post Reply

Return to “LiveCode Builder”