bind method to object that calls it

Get help with using AutoHotkey and its commands and hotkeys
Sam_
Posts: 106
Joined: 20 Mar 2014, 20:24

bind method to object that calls it

28 Mar 2018, 15:24

For example, the .Length() method operates on whatever object "calls" it (although call might not be the correct term here). This is true for any arbitrary object or array, be it Obj.Length() or this.Object[3,"foo","bar"].Length(). How do I bind a custom method/function in such a way that it behaves in a similar way? For my particular use-case, we can assume we are operating within a class, but the objects in question (and there may be hundreds) are not top-level objects (they are more like this.Object[3,"foo","bar"]). Right now I am doing something like:

Code: Select all

this.Method(this.myvar[3,"foo","bar"])

Method(ByRef Obj){
	; Perform some operation based on Obj, such as return the Length
}
But I am hoping instead to do this.myvar[3,"foo","bar"].Method()

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot], lexikos, TAC109 and 211 guests