summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-sto.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv/util-sto.lua')
-rw-r--r--tex/context/base/mkiv/util-sto.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/util-sto.lua b/tex/context/base/mkiv/util-sto.lua
index 5b6915eaf..a08d25ced 100644
--- a/tex/context/base/mkiv/util-sto.lua
+++ b/tex/context/base/mkiv/util-sto.lua
@@ -196,6 +196,19 @@ function table.getmetatablekey(t,key,value)
return m and m[key]
end
+function table.makeweak(t)
+ if not t then
+ t = { }
+ end
+ local m = getmetatable(t)
+ if m then
+ m.__mode = "v"
+ else
+ setmetatable(t,{ __mode = "v" })
+ end
+ return t
+end
+
-- Problem: we have no __next (which is ok as it would probably slow down lua) so
-- we cannot loop over the keys.