1 (изменено: alekksss, 2017-08-10 13:05:30)

Тема: AHK: MaxIndex объекта в классе

Столкнулся с проблемой такого типа:

class Class
{
	test := Object()
}
cl := new Class
cl.test[1] := 1
cl.test[2] := 2
msgbox, % cl.test.MaxIndex()

MaxIndex() ничего не возвращает. Как решается?
Поправка - тут всё работает! Но у меня в классе она ничего не возвращает!
Мой класс:

Class Key
{
	Text := Object()
	FullText := Object()
	IsEnter := Object()
	Bind := Object()
	KeyID := Object()
	Profile := Object()
	MaxKeys := Object()
	Load(lProfile)
	{
		global
		FileRead, File, %binderDir%\%lProfile%.bind
		FileObj := StrSplit(File, "------------", "`r")
		Max := FileObj.MaxIndex()
		This.MaxKeys[lProfile] := 0
		loop %Max%
		{
			bRead := Trim(FileObj[A_Index], "`r`n")
			if(!RegExMatch(bRead, "ms)\:\:ID\:(\d+)\:\:Key\:(.*)\:\:$(.*)\:\:return\:\:", ret))
				continue
			ret3 := Trim(ret3, "`r`n")
			if(This.KeyID.HasKey("Key:" ret2))
				continue
			This.Text["Key:" ret2] := StrSplit(ret3, "`n", "`r")
			This.FullText["Key:" ret2] := ret3
			This.Profile["Key:" ret2] := lProfile
			This.KeyID["Key:" ret2] := ret1
			This.Bind["ID:" ret1] := ret2
			This.MaxKeys[lProfile]++
		}
	}
	Add()
	{
	}
	Delete()
	{
	}
	Get()
	{
	}
}
global Key := new Key

2

Re: AHK: MaxIndex объекта в классе

Не знаю в чем была проблема. Но теперь всё нормально. Видимо звёзды шалят. Закрывайте.