From 6a88abae3d8ceb4463da423e934cc03e6e5ce5fa Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Sat, 8 Jun 2024 14:39:58 +0200 Subject: Lua: keep CommonState object in the registry The state is an internal value and should be treated as such. The `PANDOC_STATE` global is merely a copy; unsetting the global no longer breaks the Lua engine. --- pandoc-lua-engine/test/lua/module/globals.lua | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pandoc-lua-engine/test/lua/module') diff --git a/pandoc-lua-engine/test/lua/module/globals.lua b/pandoc-lua-engine/test/lua/module/globals.lua index 52ef226bc..4df133e46 100644 --- a/pandoc-lua-engine/test/lua/module/globals.lua +++ b/pandoc-lua-engine/test/lua/module/globals.lua @@ -147,5 +147,11 @@ return { test('has property "verbosity"', function () assert.are_equal(type(PANDOC_STATE.verbosity), 'string') end), + test('can be deleted without breaking PandocLua monad functions', function() + local state = PANDOC_STATE + PANDOC_STATE = nil + assert.is_nil(pandoc.mediabag.lookup('does-not-exist')) + PANDOC_STATE = state + end), }, } -- cgit v1.2.3