Get values from Functions Static Variables

Post your working scripts, libraries and tools for AHK v1.1 and older
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Get values from Functions Static Variables

12 Jul 2018, 13:54

I saw something identical to this while surfing the internet! (I don't know, I think it may be useful for someone!)

Code: Select all

f("@@@@")

msgbox, % ""
. F({GetVar: "x"}) "`n"
. F({GetVar: "y"}) "`n"
. F({GetVar: "z"}) "`n"
. x " - " y " - " z


F(Options)	;_________________ F (Function) _________________
{
Static x, y, z		;"Static" variables, remember values between function calls 

	if (Options["GetVar"] != "")	;if not blank\empty
	{
	Options := Options["GetVar"]
	return, (%Options%)
	}

x := "xxxxxxxxxxxxx - " Options
y := "yyyyyyyyyyyyy - " Options
z := "zzzzzzzzzzzzz - " Options
}

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: No registered users and 72 guests