From f4d0ad2ba2c4ca5bfae469650e535fd46749b3f4 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Thu, 24 Nov 2016 12:55:35 +0100 Subject: 2016-11-24 12:10:00 --- tex/context/base/mkiv/mlib-lua.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tex/context/base/mkiv/mlib-lua.lua') diff --git a/tex/context/base/mkiv/mlib-lua.lua b/tex/context/base/mkiv/mlib-lua.lua index 93ae74244..c5893ee90 100644 --- a/tex/context/base/mkiv/mlib-lua.lua +++ b/tex/context/base/mkiv/mlib-lua.lua @@ -419,3 +419,33 @@ function mp.report(a,b) report_message("%s : %s","message",a) end end + +-- + +local hashes = { } + +function mp.newhash() + for i=1,#hashes+1 do + if not hashes[i] then + hashes[i] = { } + mpprint(i) + return + end + end +end + +function mp.disposehash(n) + hashes[n] = nil +end + +function mp.inhash(n,key) + local h = hashes[n] + mpprint(h and h[key] or false) +end + +function mp.tohash(n,key) + local h = hashes[n] + if h then + h[key] = true + end +end -- cgit v1.2.3