Sign in to follow this  
Followers 0
lupusbalo

function as parameter

3 posts in this topic

It seems that a function cannot be parameter of another function

(actually I didn't find anything about it in the help file or Forum)

Could be useful to (e.g.): browse a directory and apply a function to each file in it, or pass comparison function to a sort etc...

a sort of CallBack mecanism :lmao:

something to use like:

BrowseAndApply($Dir,$BrowseSubfolderYesNo,$fileMask,$Funtion_to_apply)

As it doesn't work directly (ERROR PARSING...), I tried different things using say:

$func="somefunctionname"; also tried $somefunctionname
Func BrowseAndApply(.....$func)
......
Eval("$func(...properparameters...)") without any success.
...
EndFunc)

anybody has idea??

Share this post


Link to post
Share on other sites



You can use Call.... however, you need to use global variables because Call does not take parameters....

THX for quick answer.

actually i'am a bit reluctant to use Global variables to do that

- it's a bit more complicated, (just need not to be too sleepy :) )

- I'd bad experiences with "side-effect" :) (we all had isn't it?? o:) )

But if it's the only way, i'll do my best :lmao: & try to manage :whistle: !!!

your second point: i'am aware of that, in my post it was just "real pseudo real code" :) , and it was late!!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0