aboutsummaryrefslogtreecommitdiff
path: root/lib/collections.nom
diff options
context:
space:
mode:
Diffstat (limited to 'lib/collections.nom')
-rw-r--r--lib/collections.nom6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/collections.nom b/lib/collections.nom
index 5958bb9..9432baa 100644
--- a/lib/collections.nom
+++ b/lib/collections.nom
@@ -162,6 +162,12 @@ rule [%items sorted by %key] =:
# Metatable stuff
compile [counter] to: "setmetatable({}, {__index=function() return 0; end})"
+compile [default dict] to: ".."
+ |setmetatable({}, {__index=function(self, key)
+ | t = {};
+ | self[key] = t;
+ | return t;
+ |end})"
rule [chain %dict to %fallback] =:
when (type of %fallback) == ?:
* "table":