AutoHotkey Community

It is currently May 27th, 2012, 4:30 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: February 27th, 2010, 7:07 am 
Offline

Joined: February 2nd, 2008, 4:35 am
Posts: 643
What's the deal with it? I'm not talking about missing brackets, etc, but whether functions are allowed to contain functions. Sometimes i can call another library function (from within a librarry function), and someties i can't

I've started to create "function_INC" versions, so that certain fns can be #Include'd into certain library fns. But this is far from ideal, as i have over 200 fns to go through and alter

I've heard that if i #Include the used fns into main script, it can get around the problem??

Otherwise, is there any way to preserve my functions library the way it is, without having to use #Includes?


Last edited by a_h_k on February 27th, 2010, 11:26 am, edited 3 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 27th, 2010, 8:09 am 
Offline

Joined: April 8th, 2009, 7:49 pm
Posts: 6073
Location: San Diego, California
Your premise "Functions cannot contain functions" is flawed

This code shows they can
Code:
function(a,b,c,d)
{
  return (abs(a)+(mod(b,c)/d))
}

f:=function(-1,17,3,9)
msgbox %f%

The proper quote is "..a function cannot contain definitions of other functions"
http://www.autohotkey.com/docs/Functions.htm#gosub

You didn't post an example so I have to guess:
If a function hasn't been defined, then the first use may count as 'defining' the function.
Well it looks like I'm wrong on that.

As always, post your code.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 12:11 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
Never had a go at customizing +1 nested calls and was worried when I read this.
Code:
msgbox % call0()

call0(){
   return call1()
}
call1(){
   var := "2nd Call"
   return var
   }

Alls I can say is fheew ;)..

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Mickers, rbrtryn and 64 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group