reorg
[?]
Apr 15, 2023, 5:14 PM
NVEA3SMUPTZBTM76PANXZON47KVZ4KVIDOZCP5NQQKJ2OI22JX2ACDependencies
- [2]
WYKKFV2Gprevent overriding foundational definitions - [3]
LRDM35CEapp running again - [4]
TBWAE64Aapp is now live, can communicate with driver - [5]
QFURHRTPrename globals to have a single uppercase letter - [6]
T3RKP4IJclarify a comment
Change contents
- edit in live.lua at line 43
end-- Everything that exists before we start loading the live files is frozen and-- can't be edited live.function live.freeze_all_existing_definitions()Live.frozen_definitions = {on=true} -- special case for version 1local done = {}done[Live.frozen_definitions]=truelive.freeze_all_existing_definitions_in(_G, {}, done)endfunction live.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 enddone[tab] = truefor name,binding in pairs(tab) dolocal full_name = live.full_name(scopes, name)--? print(full_name)Live.frozen_definitions[full_name] = trueif 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)live.freeze_all_existing_definitions_in(binding, scopes, done)table.remove(scopes)endend - edit in live.lua at line 45
function live.full_name(scopes, name)local ns = table.concat(scopes, '.')if #ns == 0 then return name endreturn ns..'.'..nameend - edit in live.lua at line 332
-- === infrastructure for performing various safety checks on any new definition - replacement in live.lua at line 335
-- ========= on error, pause the app and wait for messages-- Everything that exists before we start loading the live files is frozen and-- can't be edited live.function live.freeze_all_existing_definitions()Live.frozen_definitions = {on=true} -- special case for version 1local done = {}done[Live.frozen_definitions]=truelive.freeze_all_existing_definitions_in(_G, {}, done)endfunction live.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 enddone[tab] = truefor name,binding in pairs(tab) dolocal full_name = live.full_name(scopes, name)--? print(full_name)Live.frozen_definitions[full_name] = trueif 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)live.freeze_all_existing_definitions_in(binding, scopes, done)table.remove(scopes)endendendfunction live.full_name(scopes, name)local ns = table.concat(scopes, '.')if #ns == 0 then return name endreturn ns..'.'..nameend-- === on error, pause the app and wait for messages