The function IsProperty(Obj,Key) tells whether said Key in an Object is a property or not.
This is necessary to implement bug free functions that are able to display an objects and it's content in a certain way.
IsProperty
IsProperty
Recommends AHK Studio
Re: IsProperty
But what's the point? You write a script that creates an object and the script operates over it. You should already know if said key is a property or not.
Re: IsProperty
I mentioned the point in my second sentence.
It's to display what the object contains.
I do know that said key is a property, however my function doesn't.
I use a for loop that loops through every Key and then accesses the Object with said Key and combined the results of all Keys into a string.
I can choose to display the bases too.
That's where the problem arises. I had a certain type of Object that would execute some code as soon as this property is accessed.
However since the property, using this function will not be executed within the Object but rather within the base object leading to a few "ungraceful exits" of AutoHotkey.
Using a normal For each loop (that directly gets the Key Value pair) will not result in the problem of having the property executed.
I did not do that right away because I have a certain type of Object that uses special Enumerator that works well with meta-methods.
I now have 2 functions for debugging. One is for Objects with properties and one is for those with __Get __Set meta-methods.
However I still feel like this might be an extremly helpful function in some situations. It has no priority though.
It's to display what the object contains.
I do know that said key is a property, however my function doesn't.
I use a for loop that loops through every Key and then accesses the Object with said Key and combined the results of all Keys into a string.
I can choose to display the bases too.
That's where the problem arises. I had a certain type of Object that would execute some code as soon as this property is accessed.
However since the property, using this function will not be executed within the Object but rather within the base object leading to a few "ungraceful exits" of AutoHotkey.
Using a normal For each loop (that directly gets the Key Value pair) will not result in the problem of having the property executed.
I did not do that right away because I have a certain type of Object that uses special Enumerator that works well with meta-methods.
I now have 2 functions for debugging. One is for Objects with properties and one is for those with __Get __Set meta-methods.
However I still feel like this might be an extremly helpful function in some situations. It has no priority though.
Code: Select all
ech := "a"
;^ somewhere above
;.
;.
;.
;.
class Test
{
test[]{
get{
return this.a
}
set{
return this.a := value
}
}
}
fbase := {}
For each, val in Test
fbase[ech] := val ;a simple typo can lead to fatal flaws and can go missing within large files
f := {base:fbase}
For each,Key in f.base
Msgbox % each . ":" . Key ;this is what my property debug function is doing
For each in f.base
Msgbox % each . ":" . f.base[each] ;this is roughly what my meta-method debug function is doing
Recommends AHK Studio
Who is online
Users browsing this forum: burque505 and 58 guests