Sie sind nicht angemeldet.

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

1

Montag, 6. Juni 2011, 21:31

a way to check if plugin exists?

Hi,

I want to know the existence of a plugin. If the plugin doesnt exist, I should create it. My initial thought was by checking

Quellcode

1
if(get(plugin[someplugin]) == null, addplugin(someplugin), removeplugin(someplugin));


but I cant get it to validate. I even tried get(plugin[someplugin].count) == null

Any clues? Atm I resolved it by creating a dummy plugin, so I don't get an error, but it's not the neatest way ofcourse.

Beiträge: 1 117

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : the cms4vr owner

  • Nachricht senden

2

Montag, 6. Juni 2011, 22:00

maybe this code?

Hi

Quellcode

1
if(plugin[someplugin].loaded, removeplugin(someplugin), addplugin(someplugin));


I use something similar and for me it works great.


pietero
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

3

Dienstag, 7. Juni 2011, 00:02

thanks, that did the trick!

Beiträge: 1 117

Wohnort: Poland, Europe

Beruf: krpano developer : virtual tours : the cms4vr owner

  • Nachricht senden

4

Dienstag, 7. Juni 2011, 09:52

*thumbup*

pietero
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

5

Mittwoch, 8. Juni 2011, 00:05

Hi,

the 'strict equal' if operater (===) would be also a possibility,

e.g.

Quellcode

1
2
if(plugin[xyz] === null, trace(there is NO plugin named xyz));
if(plugin[xyz] !== null, trace(there is a plugin named xyz));


best regards,
Klaus

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

6

Sonntag, 24. Juli 2011, 01:25

I still having problems when I put this in an loop...

if(plugin[get(thumbname)] !== null,
removeplugin(thumbname);
);

sometimes returns ERROR: remove - unknown array item - thumbname

which doesnt make sense, it shoudnt pass the if statement if i couldnt delete it :(

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

7

Sonntag, 24. Juli 2011, 06:00

KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

Zephyr

Profi

  • »Zephyr« ist der Autor dieses Themas

Beiträge: 1 003

Wohnort: Netherlands

Beruf: Web developer

  • Nachricht senden

8

Sonntag, 24. Juli 2011, 12:21

thanks :) I had another error. I tried to removeplugin(thumbname) instead of get(thumbname).

this works:

Quellcode

1
2
3
4
txtadd(thumbname,'thumb_', get(i));
				if(plugin[get(thumbname)].loaded, 
					removeplugin(get(thumbname));
					);


but this too, and i find this better:

Quellcode

1
2
3
4
txtadd(thumbname,'thumb_', get(i));
				if(plugin[get(thumbname)] !== null, 
					removeplugin(get(thumbname));
					);

Ähnliche Themen