mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
24 lines
568 B
Text
24 lines
568 B
Text
# @TEST-EXEC: zeek -b %INPUT > out
|
|
# @TEST-EXEC: btest-diff out
|
|
|
|
const foo: table[string] of double &redef;
|
|
|
|
# full (re)initialization
|
|
redef foo = { ["nope"] = 37.0 };
|
|
|
|
# full (re)initialization, discards "nope" index
|
|
redef foo = { ["abc"] = 42.0 };
|
|
|
|
# add elements
|
|
redef foo += { ["def"] = -42.0, ["ghi"] = 7.0 };
|
|
|
|
# remove elements from LHS based on indices shared with RHS
|
|
redef foo -= { ["ghi"] = 0.0 };
|
|
|
|
# RHS can be a table value
|
|
redef foo += table(["cool"] = 5.0, ["neat"] = 1.0);
|
|
|
|
# redef a single element using +=
|
|
redef foo += { ["def"] = 99.0 };
|
|
|
|
print foo;
|