Code: Select all
MsgBox ObjCount({}) ; Call to nonexistent function
MsgBox {1:0,2:0}.Count() ; 2
https://lexikos.github.io/v2/docs/objects/Object.htm
Code: Select all
MsgBox ObjCount({}) ; Call to nonexistent function
MsgBox {1:0,2:0}.Count() ; 2
Edit: I do see it says Object.Count, and not ObjCountCount := Object.Count()
Returns the number of key-value pairs present in the object.Code: Select all
MsgBox % {A: 1, Z: 26}.Count() ; 2 MsgBox % ["A", "B", "C"].Count() ; 3 MsgBox % ["A", , "C"].Count() ; 2
Code: Select all
myObject := Array("1","2","3","4")
msgbox myObject.Count()
btw: works well on AHKv1.Each method also has an equivalent function, which can be used to bypass any custom behaviour implemented by the object [..]
Code: Select all
myObject := Array("1","2","3","4")
x := myObject.Count()
msgbox %x% ; "4"
y := ObjCount(myObject) ; also "4"
msgbox %y%
It's not in the built-in function array in script.cpp. (Lexikos probably overlooked it, since it's just one line missing).Flipeador wrote:btw: works well on AHKv1.Each method also has an equivalent function, which can be used to bypass any custom behaviour implemented by the object [..]
Users browsing this forum: No registered users and 26 guests