List all the methods from a base class? Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
tic
Posts: 89
Joined: 03 Nov 2014, 03:10

List all the methods from a base class?

19 May 2017, 13:33

How can we list all the methods from a baseClass?

The following will work by explicitly using MyClass by name, but how can we use this to get the methods myMethod1 and myMethod2?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

tic
Posts: 89
Joined: 03 Nov 2014, 03:10

Re: List all the methods from a base class?

19 May 2017, 13:55

I had not tried putting the percentages around a. Very odd syntax, considering both k and v are objects and do not require % to qualify them.
Anyway, thanks!
Helgef
Posts: 2098
Joined: 17 Jul 2016, 01:02
Contact:

Re: List all the methods from a base class?

19 May 2017, 14:06

Indeed, see %var% (double-deref).
Cheers.
lexikos
Posts: 5408
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: List all the methods from a base class?

19 May 2017, 17:20

this.base refers to the class directly. :facepalm:
User avatar
jeeswg
Posts: 2043
Joined: 19 Dec 2016, 01:58
Location: UK

Re: List all the methods from a base class?

19 May 2017, 18:09

This is interesting, it's one of the few times I've seen __Class or __Init anywhere. Btw so if you test this on a normal AHK object, it shows nothing?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

A_AhkUser
Posts: 437
Joined: 06 Mar 2017, 16:18
Location: France

Re: List all the methods from a base class?

19 May 2017, 18:41

Naturally since you loop throught .base - compare:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Video Game Reader
Image
github
demo
Helgef
Posts: 2098
Joined: 17 Jul 2016, 01:02
Contact:

Re: List all the methods from a base class?

19 May 2017, 22:37

Btw, init!=__Init.
A_AhkUser
Posts: 437
Joined: 06 Mar 2017, 16:18
Location: France

Re: List all the methods from a base class?

20 May 2017, 09:58

Code: [Select all] [Download] GeSHi © Codebox Plus

Class C {

prop := 7
__Init() {
var := "test"
}

} ; Error at line 148. Line Text: __Init Error: Duplicate declaration. The program will exit.


> Doesn't work: duplicate declaration due to the prop instance variable declaration:

documentation wrote:These declarations are evaluated each time a new instance of the class is created with the new keyword. The method name __Init is reserved for this purpose (...)


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



>It appears that this works - however the documentation asserts that
[__init method] should not be used by the script


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



> Works since the method name doesn't start with two underlines; it is not a meta-function.
Video Game Reader
Image
github
demo

Return to “Ask For Help”

Who is online

Users browsing this forum: PhilippeBruno, Spawnova and 63 guests