Re: Part of const array with same value

"[email protected]" <[email protected]> Sat, 7 Dec 2019 09:00:29 -0500
Newsgroups gmane.comp.security.detection.bro
Message-ID <CAC_rUhL6gbnk0nZmVdq7fsi570Pq88WfZM9QyAb3Li7vUthVBA@mail.gmail.com>
--===============1099723291==
Content-Type: multipart/alternative; boundary="000000000000831e2005991d965e"

--000000000000831e2005991d965e
Content-Type: text/plain; charset="UTF-8"

What's the use of this array?

On Fri, Dec 6, 2019, 10:36 PM TQ <[email protected]> wrote:

> Hello Zeekers,
>
> What is the best way to represent indices of an array with the same
> value?  Let's say I declare a constant string array used for enumeration
> called 'test'.  Values 0 and 1 has some unique value, but anything from 2
> and 7 has a constant value of 'test2'.  Is there a quicker way of
> representing this or would I need to manually set it?
>
> const test = {
>     [0] = "test0",
>     [1] = "test1",
>     [2] = "test2",
>     [3] = "test2",
>     [4] = "test2",
>     [5] = "test2",
>     [6] = "test2",
>     [7] = "test2",
>     [8] = "test3",
>     } &default=function(i: count):string { return fmt("test(%x)", i); }
> &redef;
>
> Thanks,
> _______________________________________________
> Zeek mailing list
> [email protected]
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/zeek

--000000000000831e2005991d965e
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">What&#39;s the use of this array?</div><br><div class=3D"=
gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Fri, Dec 6, 2019, 10:=
36 PM TQ &lt;<a href=3D"mailto:[email protected]">[email protected]=
om</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">=
Hello Zeekers,<br><div><br></div><div>What is the best way to represent ind=
ices of an array with the same value?=C2=A0 Let&#39;s say I declare a const=
ant string array used for enumeration called &#39;test&#39;.=C2=A0 Values 0=
 and 1 has some unique value, but anything from 2 and 7 has a constant valu=
e of &#39;test2&#39;.=C2=A0 Is there a quicker way of representing this or =
would I need to manually set it?</div><div><br></div><div>const test =3D {<=
br>=C2=A0 =C2=A0 [0] =3D &quot;test0&quot;,<br>=C2=A0 =C2=A0 [1] =3D &quot;=
test1&quot;,</div><div><div>=C2=A0 =C2=A0 [2] =3D &quot;test2&quot;,<br>=C2=
=A0 =C2=A0 [3] =3D &quot;test2&quot;,</div><div><div>=C2=A0 =C2=A0 [4] =3D =
&quot;test2&quot;,<br>=C2=A0 =C2=A0 [5] =3D &quot;test2&quot;,</div><div></=
div></div><div></div><div><div>=C2=A0 =C2=A0 [6] =3D &quot;test2&quot;,<br>=
=C2=A0 =C2=A0 [7] =3D &quot;test2&quot;,</div><div>

=C2=A0 =C2=A0 [8] =3D &quot;test3&quot;,

<br></div><div></div></div>=C2=A0 =C2=A0 } &amp;default=3Dfunction(i: count=
):string { return fmt(&quot;test(%x)&quot;, i); } &amp;redef;<br></div><div=
><br></div><div>Thanks,</div></div>
_______________________________________________<br>
Zeek mailing list<br>
<a href=3D"mailto:[email protected]" target=3D"_blank" rel=3D"noreferrer">zeek@=
zeek.org</a><br>
<a href=3D"http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/zeek" rel=3D"n=
oreferrer noreferrer" target=3D"_blank">http://mailman.ICSI.Berkeley.EDU/ma=
ilman/listinfo/zeek</a></blockquote></div>

--000000000000831e2005991d965e--

--===============1099723291==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Zeek mailing list
[email protected]
http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/zeek
--===============1099723291==--