Seite 1 von 1

Local Functions

Verfasst: 22 Aug 2018, 14:11
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?

Re: Local Functions

Verfasst: 27 Aug 2018, 15:03
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

Re: Local Functions

Verfasst: 28 Aug 2018, 15:45
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.