OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods? Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

02 Aug 2021, 18:24

i dont expect anyone to really answer other than lexikos, since no one has any idea how objects in v2 work, but who knows maybe a miracle happens and someone can figure it out

Code: Select all

#Requires AutoHotkey v2.0-beta

msgbox("prop count=" ObjOwnPropCount(cls))
for k,v in cls.OwnProps()
   msgbox("index=" A_Index "`nk=" k)

msgbox("prop count=" ObjOwnPropCount(cls.prototype))
for k,v in cls.prototype.OwnProps()
   msgbox("index=" A_Index "`nk=" k)

instance := cls()
msgbox("prop count=" ObjOwnPropCount(instance.base))
for k,v in instance.base.OwnProps()
   msgbox("index=" A_Index "`nk=" k)

class cls
{
   one()
   {
   }

   two()
   {
   }

   three()
   {
   }
}


User avatar
kczx3
Posts: 1644
Joined: 06 Oct 2015, 21:39

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

02 Aug 2021, 18:45

since no one has any idea how objects in v2 work
Really? Do you honestly think that?
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

02 Aug 2021, 18:48

kczx3 wrote:
02 Aug 2021, 18:45
Really? Do you honestly think that?
yes, the object logic has changed so many times that you can probably count the number of people who understand it on one hand. regardless

can you answer the question in the topic? or make sense of the example code?

User avatar
kczx3
Posts: 1644
Joined: 06 Oct 2015, 21:39

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

02 Aug 2021, 18:50

Not at a computer at the moment to run the code and provide feedback
guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?

02 Aug 2021, 18:53

kczx3 wrote:
02 Aug 2021, 18:50
Not at a computer at the moment to run the code and provide feedback
prop counts are 2,4,4 respectively in order, yet each for loop only iterates 1 time, with keys: "prototype", "__class", "__class"

guest3456
Posts: 3463
Joined: 09 Oct 2013, 10:31

Re: OwnProps conflicts ObjOwnPropCount - how do you enumerate over all methods?  Topic is solved

02 Aug 2021, 19:12

ok i figured it out, apparently the for loop requires one variable instead of two

Code: Select all

for k in prototype.ownprops
;not
for k,v in prototype.ownprops


Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Draken, songdg and 59 guests