How to use class 'this.' var inside of var = ( ) ?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Chappier
Posts: 44
Joined: 21 Aug 2021, 21:58

How to use class 'this.' var inside of var = ( ) ?

Post by Chappier » 10 Aug 2022, 11:03

Code: Select all

foo.x()
return

Class foo {

   x() {
      this.color := "blue"
      text =
      (LTrim
        color is this.color
      )
      MsgBox text: %text%
   }
}
how to use the value of this.color inside of text = ( )?

do i necessarily need to append it to another variable and call it with %%?

Code: Select all

x() {
      this.color := "blue"
      color := this.color ; <------ ???????
      
      text =
      (LTrim
        color is %color%
      )
      MsgBox text: %text%
   }

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: How to use class 'this.' var inside of var = ( ) ?

Post by swagfag » 10 Aug 2022, 11:15

use a variable, or use a non-legacy expression or use Format with a placeholder string

Post Reply

Return to “Ask for Help (v1)”