Is it possible to check a Value if it's a Variable?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
GamesOfFreak
Posts: 28
Joined: 15 Sep 2020, 03:51
Location: Germany
Contact:

Is it possible to check a Value if it's a Variable?

Post by GamesOfFreak » 25 May 2023, 15:19

I want to make a custom Function that allows you to clear a Variable.

But I want to be sure that the Parameter in the Function is a Variable.

Is it possible?

User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: Is it possible to check a Value if it's a Variable?

Post by mikeyww » 25 May 2023, 16:12

Code: Select all

#Requires AutoHotkey v2.0

varName := 'x'
x       := 4
MsgBox x
clear(varName)
MsgBox x

clear(varName) {
 Global
 %varName% := ''
}

User avatar
Datapoint
Posts: 311
Joined: 18 Mar 2018, 17:06

Re: Is it possible to check a Value if it's a Variable?

Post by Datapoint » 25 May 2023, 16:59

GamesOfFreak wrote:
25 May 2023, 15:19
But I want to be sure that the Parameter in the Function is a Variable.

Code: Select all

	if !IsSet(%varName%) {
		MsgBox varName " is not set."
		return
	}

Post Reply

Return to “Ask for Help (v2)”