From c1281433ba605fb9073288f3937b8df1f14570f6 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sun, 10 Nov 2024 17:11:10 -0500 Subject: Allows for accessible false variables. --- src/lpm.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/lpm.lua b/src/lpm.lua index 55ee00b..a82c15e 100644 --- a/src/lpm.lua +++ b/src/lpm.lua @@ -1,4 +1,5 @@ _S = {} +for k,v in pairs(_G) do _S[k] = true end function global(g) if #g > 0 then for i,v in ipairs(g) do rawset(_S, g[i], true) end else for k,v in pairs(g) do rawset(_G, k, v) rawset(_S, k, true) end end end setmetatable(_G, { __index = function(t, k) if not rawget(_S, k) then error("cannot get undefined global variable: " .. k, 2) end end, __newindex = function(t, k, v) if rawget(_S, k) then rawset(t, k, v) else error("cannot set global variable: " .. k, 2) end end }) @@ -606,6 +607,7 @@ end function common.get(source, options) + assert(not NO_NETWORK, "aborting networking action") options = options or {} if not options.depth then options.depth = {} end table.insert(options.depth, source) -- cgit v1.2.3