Scripting: User-Defined Functions

Features wanted...
PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

Next (I think) :bug:
:oops:

Defaults for parameters are specified without quotes. If you use quotes they are part of the default value.
But: I need special characters, like blank or ')' :blackstorm:
So I think defaults should should be quoted as every string?

By the way: if not defining a default, and not supplying a value for a variable, the default is ""?
W7(x64) SP1 German
( +WXP SP3 )

admin
Site Admin
Posts: 50044
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting: User-Defined Functions

Post by admin »

1) Yep, :bug:

2) Yes, "".
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

:D
W7(x64) SP1 German
( +WXP SP3 )

PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

By the way: you always write like:
! Scripting: Included functions were effectively not updated after loading a
script using User | Run Script | Load selected script file. Fixed.
I think people usually don't use User | ... but Scripting | Load Script File or Scripting / Load Selected Script File.

User | ... is only defined if you have defined it :mrgreen:
(and is there need for it, in this case?)
W7(x64) SP1 German
( +WXP SP3 )

admin
Site Admin
Posts: 50044
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting: User-Defined Functions

Post by admin »

Whoops, what a stupid oversight. :oops: I happen to have a UDC with that same name (just for testing). :whistle:
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

Hoppala - for .317:

I wrote defaults as $b01='ol', i.e.used single quotes. The quotes were taken into the variables :P
With double quotes OK :whistle:

(Should I stop testing? :biggrin:
No problem - I'm hungry now :P )
W7(x64) SP1 German
( +WXP SP3 )

admin
Site Admin
Posts: 50044
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting: User-Defined Functions

Post by admin »

No, you should stop using single quotes. They are not supported here. :)
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Scripting: User-Defined Functions

Post by SammaySarkar »

not good.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

admin wrote:No, you should stop using single quotes. They are not supported here. :)
Is the emoticon you wanted to use: :wink:
As I don't think it makes sense this way!

Reason: you would have to teach new rules for this one case to all scripters:
- don't use 'single quotes'
- don't double double quotes inside double quotes ( :mrgreen: ) :arrow: not ="""c:\a b\""" but =""c:\a b\""
- maybe more? Please document!

Or use the rules valid for all other situations, like
global $a='"c:\a b\"'; // For me this is almost the same use case, isn't it?
So I hope it was a joke :wink:

(Thanks, Sammay :D )
W7(x64) SP1 German
( +WXP SP3 )

admin
Site Admin
Posts: 50044
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting: User-Defined Functions

Post by admin »

SammaySarkar wrote:not good.
good point :mrgreen:
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

admin
Site Admin
Posts: 50044
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting: User-Defined Functions

Post by admin »

PeterH wrote:
admin wrote:No, you should stop using single quotes. They are not supported here. :)
Is the emoticon you wanted to use: :wink:
As I don't think it makes sense this way!

Reason: you would have to teach new rules for this one case to all scripters:
- don't use 'single quotes'
- don't double double quotes inside double quotes ( :mrgreen: ) :arrow: not ="""c:\a b\""" but =""c:\a b\""
- maybe more? Please document!

Or use the rules valid for all other situations, like
global $a='"c:\a b\"'; // For me this is almost the same use case, isn't it?
So I hope it was a joke :wink:

(Thanks, Sammay :D )
Yes, just added. It's the weather...
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

Weather, yes!
My feet hurt - I walked some km on the A33 (That's the German highway 33 8) ) (between testing :whistle: )
(OK: this is a piece that's just on construction, so no problems with traffic.)

This says: weather in Germany is very fine :D sunny, sunny, sunny :D

There's an emoticon :blackstorm: , but none for the sun :cry:
OK: I'll try :idea:

Sorry for OT :biggrin:

PS: just found out why you changed your mind: you thought about documenting the new rules :appl: :ninja:
W7(x64) SP1 German
( +WXP SP3 )

admin
Site Admin
Posts: 50044
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Scripting: User-Defined Functions

Post by admin »

Yes. :)
FAQ | XY News RSS | XY Twitter | Stay home! 🎸 Or wear a mask! 😷

PeterH
Posts: 2594
Joined: 21 Nov 2005 20:39
Location: Germany

Re: Scripting: User-Defined Functions

Post by PeterH »

Tested, even some strange (= never used) parameter combinations: all well.
Not bad! :)


To be true: very very lucky. I've waited for this quite a time - and now it's there.
...and enjoyed testing :D

Thanks a lot!
And so many new abilities :ugeek:
W7(x64) SP1 German
( +WXP SP3 )

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Scripting: User-Defined Functions

Post by SammaySarkar »

Code: Select all

  $b = 'var_$b';
  echo q();
function q($a = "1" . "2" , $b) { return $a . | . $b ; } //returns 1" . "2|var_$b

Code: Select all

function q($a = """1" . """2" , $b) { return $a . | . $b ; } //returns "1" . "2"|var_$b
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply