AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Yet anothr "Functions .. contain functions" thread

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
a_h_k



Joined: 02 Feb 2008
Posts: 626

PostPosted: Sat Feb 27, 2010 6:07 am    Post subject: Yet anothr "Functions .. contain functions" thread Reply with quote

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 Sat Feb 27, 2010 10:26 am; edited 3 times in total
Back to top
View user's profile Send private message Visit poster's website
Leef_me



Joined: 08 Apr 2009
Posts: 5336
Location: San Diego, California

PostPosted: Sat Feb 27, 2010 7:09 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Mon Mar 08, 2010 11:11 pm    Post subject: Reply with quote

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 Wink..
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group