<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK: array.base]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=16069</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=16069&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK: array.base».]]></description>
		<lastBuildDate>Wed, 10 Feb 2021 10:04:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK: array.base]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=146112#p146112</link>
			<description><![CDATA[<p>Не знаю, наверно никак.</p>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Wed, 10 Feb 2021 10:04:31 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=146112#p146112</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: array.base]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=146105#p146105</link>
			<description><![CDATA[<p>А если допустим я буду использовать только ее, как ее &quot;починить&quot;? Метод выше не очень устраивает.</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Wed, 10 Feb 2021 02:55:54 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=146105#p146105</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK: array.base]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=146069#p146069</link>
			<description><![CDATA[<p>Думаю, что переопределять все объекты в скрипте не очень хорошая идея. Представьте, что вы используете несколько библиотек, где каждый автор переопределяет их на свой лад. Или наоборот, вы можете своим переопределением испортить работу объектов, авторы которых не рассчитывали на подобное.<br />Лучше изменять, если нужно, конкретные объекты:<br /></p><div class="codebox"><pre><code>arr := StrSplit(&quot;1 2 3 4 5 6&quot;, &quot; &quot;)
arr.base := _Array
newArr := arr.slice(3)

for k, v in newArr
   str .= (k = 1 ? &quot;&quot; : &quot;, &quot;) . v
MsgBox, % str

class _Array
{
   slice(start:=0, end:=0)
   {

      len := this.Length()

      ; START: Adjust 1 based index, check signage, set defaults
      if (start &gt; 0)
         begin := start - 1   ; Include starting index going forward
      else if (start &lt; 0)
         begin := len + start  ; Count backwards from end
      else
         begin := start


      ; END: Check signage and set defaults
      ; MDN States: &quot;to end (end not included)&quot; so subtract one from end
      if (end &gt; 0)
         last := end - 1
      else if (end &lt; 0)
         last := len + end + 1 ; Count backwards from end
      else
         last := len


      results := []

      loop, % last - begin
         results.push(this[begin + A_Index])

      return results
   }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (teadrinker)]]></author>
			<pubDate>Tue, 09 Feb 2021 14:19:24 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=146069#p146069</guid>
		</item>
		<item>
			<title><![CDATA[AHK: array.base]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=146067#p146067</link>
			<description><![CDATA[<p>Давненько нашел на просторах интернета, библиотеку, которая переносит JS функции в AHK. Там что-то подобное..</p><div class="codebox"><pre><code>Array(prms*)
{
	prms.base := _Array
	return prms
}

class _Array
{
	slice(start:=0, end:=0)
	{

		len := this.Length()

		; START: Adjust 1 based index, check signage, set defaults
		if (start &gt; 0)
			begin := start - 1	; Include starting index going forward
		else if (start &lt; 0)
			begin := len + start  ; Count backwards from end
		else
			begin := start


		; END: Check signage and set defaults
		; MDN States: &quot;to end (end not included)&quot; so subtract one from end
		if (end &gt; 0)
			last := end - 1
		else if (end &lt; 0)
			last := len + end + 1 ; Count backwards from end
		else
			last := len


		results := []

		loop, % last - begin
			results.push(this[begin + A_Index])

		return results
	}
}</code></pre></div><p>Вроде все работает, если сделать допустим так:<br /></p><div class="codebox"><pre><code>arr := [1, 2, 3, 4, 5, 6]
newArr := arr.slice(3) // [3, 4, 5, 6]</code></pre></div><p>Но это не работает вот так:<br /></p><div class="codebox"><pre><code>arr := StrSplit(&quot;1 2 3 4 5 6&quot;, &quot; &quot;)
newArr := arr.slice(3) // []</code></pre></div><p>К тому же это все нельзя было применить к Object.</p>]]></description>
			<author><![CDATA[null@example.com (Phoenixxx_Czar)]]></author>
			<pubDate>Tue, 09 Feb 2021 12:56:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=146067#p146067</guid>
		</item>
	</channel>
</rss>
