[v1] array extend

Propose new features and changes
CzarOfScripts
Posts: 7
Joined: 09 Apr 2021, 05:57

[v1] array extend

Post by CzarOfScripts » 11 May 2022, 19:25

I want to extend the "class" Array to add my functions, I saw this do the code below, but it is not suitable for all cases.

Code: Select all

; Work
msgbox, % [1, 2, 3].join()

; Don't work
msgbox, % StrSplit("123").join()


Array(prms*)
{
	prms.base := _Array
	return prms
}

class _Array
{
	join(delimiter := "`n")
	{
		str := ""

		for key, value in this
		{
			str .= (A_Index == 1 ? "" : delimiter) value
		}

		return str
	}
}

I want to be able to do it at least that way:

Code: Select all

class _Array extends Array
{
	join(delimiter := "`n")
	{
		str := ""

		for key, value in this
		{
			str .= (A_Index == 1 ? "" : delimiter) value
		}

		return str
	}
}

Return to “Wish List”