Local Functions

Antworten
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Local Functions

Beitrag von SisterOfMercy »

https://download.uib.de/opsi4.1/documen ... lfunctions

Uhm, the catch is that you can not put those local functions just anywhere in the [actions] part of the script. You have to define the function first, then you can use it. Of course, this seems logical after a while, it is a script that is parsed.

However, wouldn't it be a better idea to have a place where you can just dump the local functions? [functions] perhaps?
Or would it be better to not include local functions at all, in most cases, and just load a common library on the client with functions?
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Benutzeravatar
d.oertel
uib-Team
Beiträge: 3319
Registriert: 04 Jun 2008, 14:27

Re: Local Functions

Beitrag von d.oertel »

Hi Sister,

you are right, opsis-script is an interpreter and so a function has to be known before you can call it.

I will write a big hint in the docu pointing to this.

From my point of view is this the best way.

And it is now implemented this way. To change this without breaking the scripts that using the now implemented way would be hard.

cheers
detlef
opsi support - uib gmbh

For productive opsi installations we recommend support contracts.
http://www.uib.de
http://www.opsi.org
Benutzeravatar
SisterOfMercy
Beiträge: 1522
Registriert: 22 Jun 2012, 19:18

Re: Local Functions

Beitrag von SisterOfMercy »

d.oertel hat geschrieben:I will write a big hint in the docu pointing to this.
Thanks, that will be enough.
Maybe we can teach jEdit to fold the code, but that is totally outside the scope of opsi.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!
Antworten