Quantcast

pkg function

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

pkg function

Nir Krakauer-3
Is there a way to check from within a script or function whether a particular package is currently loaded?

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pkg function

Oliver Heimlich

On 08.05.2017 19:41, Nir Krakauer wrote:
> Is there a way to check from within a script or function whether a
> particular package is currently loaded?

pkg ("list", "pkgname"){1}.loaded

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pkg function

Nir Krakauer-3
That doesn't work for me (with 4.2.1):

> pkg("list", "tsa"){1}.loaded

Package Name  | Version | Installation directory
--------------+---------+-----------------------
         tsa  |   4.4.1 | ~/octave/tsa-4.4.1
error: can't perform indexing operations for <unknown type> type

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pkg function

Nir Krakauer-3
But it does work with two steps:

a = pkg("list", "tsa");
a{1}.loaded

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pkg function

Olaf Till-2
On Mon, May 08, 2017 at 03:01:54PM -0400, Nir Krakauer wrote:
> But it does work with two steps:
>
> a = pkg("list", "tsa");
> a{1}.loaded

A trick in such cases is

(a = pkg("list", "tsa")){1}.loaded

Olaf

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

signature.asc (836 bytes) Download Attachment
Loading...