diff options
author | Adam Harrison <adamdharrison@gmail.com> | 2024-11-10 17:11:10 -0500 |
---|---|---|
committer | Adam Harrison <adamdharrison@gmail.com> | 2024-11-10 17:11:10 -0500 |
commit | c1281433ba605fb9073288f3937b8df1f14570f6 (patch) | |
tree | e185839499091ef5bcea404e47ed852e37370deb | |
parent | 98dd339dcd779c5fba4249ace8b6a860484e3e1c (diff) | |
download | lite-xl-plugin-manager-c1281433ba605fb9073288f3937b8df1f14570f6.tar.gz lite-xl-plugin-manager-c1281433ba605fb9073288f3937b8df1f14570f6.zip |
Allows for accessible false variables.PR/split-compile-options
-rw-r--r-- | src/lpm.lua | 2 |
1 files changed, 2 insertions, 0 deletions
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) |