Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Problem with Meta-Functions in Classes



  • Please log in to reply
2 replies to this topic
nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

Hi I recently discovered a strange behavior.

Here is the Script:

Class nothing
{
__get(a,b=0)
{
msgbox % "a:=" a "b:=" b	
}
}
none:=new nothing()
none[1,2] ;normal
none[1].2 ;not normal
none.1[2] ;normal
none.1.2  ;not normal

AHK_L 1.1.10.1 ANSI WXP 32 bit SP3


Visit the new forum ahkscript.org.

http://ahkscript.org


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
✓  Best Answer
obj[a,a2] is internally equivalent to ObjGet(obj,a,a2), whereas obj[a].a2 is the same as ObjGet(ObjGet(obj,a),"a2"), hence omitting the parameter. Since the return value of __Get is not an object, the other get operation does nothing (unless you were using the default base object). Same goes for the other two cases. (ObjGet is an internal built-in-function that is not directly exposed to script)

EDIT: Unchecking "Allow emoticons" does NOT work, and is VERY annoying.

nnnik
  • Members
  • 1625 posts
  • Last active: Jan 24 2019 02:19 PM
  • Joined: 28 Jul 2012

I was just unsure if this is wanted or not.


Visit the new forum ahkscript.org.

http://ahkscript.org