Is it possible this will work?
If so, the programmer's responsibility is to ensure App.initialize_globals() has no side-effects besides initializing global bindings.
D5KRDRYYRE577UK2HETVORW7HQQUI7ZGLDG6N56QLDDOX6GP4O5QC endendfunction live.shallow_copy_all_globals()local result = {}for k,v in pairs(_G) doresult[k] = vendreturn resultendfunction live.restore_all_globals(x)-- delete extra bindingsfor k,v in pairs(_G) doif x[k] == nil then_G[k] = nilendend-- restore previous bindingsfor k,v in pairs(x) do_G[k] = v