4ULMOX2DU6EKVUDEVNVVD3LPKR7FL46KXE5M7R3UGAVWUQHLO2JAC
GN2ZGATN7BSOOOPQ354YZZHUN4DHPPXU6CFDSVKXTG24SN2CDM2QC
EP5R7WRBMFV7CFIVIWWOUUCB3E4HMNTJGJPKMHE6YH3XMERQXCGQC
ZJPFAJVMVVKNZCQPQPCHIPCLMG5VRNVUMG5ZY3VR5B57PRNFJAOAC
3T4OMAPQBS6TPV2CJNCK3PXWTELMOYS2ZKJXMG4RELNME3ZNQWFQC
GAOTNMBJGXMED675ZULUSZESGBWGDEYCMNLBTXZHINBLGHMQSRSQC
R4PMTRF75RCAYGFCEPWKF6YE73YCHW5S36F76O3FWIQVNBKTTNSAC
C6AT7PEUHQMNRTF2EJOGDDULKPZRF3SRUXTNUSIAKTWFIN4ILZEQC
end
-- Everything that exists before we start loading the live files is frozen and
-- can't be edited live.
function app.freeze_all_existing_definitions()
app.Frozen_definitions = {on=true} -- special case for version 1
local done = {}
done[app.Frozen_definitions]=true
app.freeze_all_existing_definitions_in(_G, {}, done)
function app.freeze_all_existing_definitions_in(tab, scopes, done)
-- track duplicates to avoid cycles like _G._G, _G._G._G, etc.
if done[tab] then return end
done[tab] = true
for name,binding in pairs(tab) do
local full_name = app.full_name(scopes, name)
--? print(full_name)
app.Frozen_definitions[full_name] = true
if type(binding) == 'table' and full_name ~= 'package' then -- var 'package' contains copies of all modules, but not the best name; rely on people to not modify package.loaded.io.open, etc.
table.insert(scopes, name)
app.freeze_all_existing_definitions_in(binding, scopes, done)
table.remove(scopes)
end
end
end
function app.full_name(scopes, name)
local ns = table.concat(scopes, '.')
if #ns == 0 then return name end
return ns..'.'..name
end
end
-- Everything that exists before we start loading the live files is frozen and
-- can't be edited live.
function app.freeze_all_existing_definitions()
app.Frozen_definitions = {on=true} -- special case for version 1
local done = {}
done[app.Frozen_definitions]=true
app.freeze_all_existing_definitions_in(_G, {}, done)
function app.freeze_all_existing_definitions_in(tab, scopes, done)
-- track duplicates to avoid cycles like _G._G, _G._G._G, etc.
if done[tab] then return end
done[tab] = true
for name,binding in pairs(tab) do
local full_name = app.full_name(scopes, name)
--? print(full_name)
app.Frozen_definitions[full_name] = true
if type(binding) == 'table' and full_name ~= 'package' then -- var 'package' contains copies of all modules, but not the best name; rely on people to not modify package.loaded.io.open, etc.
table.insert(scopes, name)
app.freeze_all_existing_definitions_in(binding, scopes, done)
table.remove(scopes)
end
end
end
function app.full_name(scopes, name)
local ns = table.concat(scopes, '.')
if #ns == 0 then return name end
return ns..'.'..name
end