Why don't numbers value "this"?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
lordkrandel
Posts: 3
Joined: 27 Nov 2014, 04:35

Why don't numbers value "this"?

27 Nov 2014, 08:14

Why don't numbers value "this"?

Code: Select all


{
    "".base.base := MyBase

    "abba".msgbox()      ; OK  ">> abba"
    ([1,2,3,4]).msgbox() ; OK  ">> object"

    ; Why don't numbers value "this"?
    0.base.base  := MyBase
    1234.msgbox()        ; NOK ">> "
          ; SOLVED, should be (1234.msgbox())   ; OK  ">> 1234"
    Msgbox, % 1.base.base.__class  ; MyBase  ; edited
}

Class MyBase {
    msgbox(){        
        if isobject(this) {
            l_s := "object"
        } else {
            l_s := this
        }
        Msgbox, % ">> " l_s
    }
}

Array(a_params*){
    a_params.base := MyBase
    return a_params
}
Object(a_params*){
    a_params.base := MyBase
    return a_params
}

Last edited by lordkrandel on 27 Nov 2014, 10:36, edited 2 times in total.
User avatar
trismarck
Posts: 506
Joined: 30 Sep 2013, 01:48
Location: Poland

Re: Why don't numbers value "this"?

27 Nov 2014, 10:05

In this syntax: 1234.msgbox() 1234 is treated as a variable. To pass the number as 'this', use parentheses.
Msgbox, % 1.base.base__class ; MyBase this line is missing a dot I believe.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, mikeyww, PsysimSV and 296 guests