It would work in such a case:Setting a default value does not prevent an error from being thrown when the index is out of range.
Code: Select all
Array.Prototype.DefineProp("Default", {get:(*)=>""})
test := ["a",,"b"]
MsgBox test[2]
It would work in such a case:Setting a default value does not prevent an error from being thrown when the index is out of range.
Code: Select all
Array.Prototype.DefineProp("Default", {get:(*)=>""})
test := ["a",,"b"]
MsgBox test[2]
Code: Select all
OverrideArray()
OverrideArray() {
Get := Array.Prototype.GetOwnPropDesc('__Item').Get
Array.Prototype.DefineProp('__Item', {Get: (this, key) => this.Has(key) ? Get(this, key) : ''})
}
a := [1]
MsgBox a[1] " " a[2]
Users browsing this forum: No registered users and 65 guests