[Zeek] Part of const array with same value

kilotao at gmail.com kilotao at gmail.com
Sat Dec 7 06:00:29 PST 2019


What's the use of this array?

On Fri, Dec 6, 2019, 10:36 PM TQ <nothinrandom at gmail.com> 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
> zeek at zeek.org
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/zeek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ICSI.Berkeley.EDU/pipermail/zeek/attachments/20191207/680a4362/attachment.html 


More information about the Zeek mailing list