That will allow us to discover the top-level symbols for completion.
For others we can e.g.: for n in pairs(net) do print(n); end
I must admit I fail to understand some of the related lua magic.
-- Make sandboxed environment
local function make_sandbox(defined)
local __protected = { modules = true, cache = true, net = true, trust_anchors = true }
- return setmetatable({}, {
+
+ -- Compute and export the list of top-level names (hidden otherwise)
+ local nl = ""
+ for n in pairs(defined) do
+ nl = nl .. n .. "\n"
+ end
+
+ return setmetatable({ __orig_name_list = nl }, {
__index = defined,
__newindex = function (t, k, v)
if __protected[k] then