driver.love/0060-load_manifest

20 lines
585 B
Plaintext

load_manifest = function()
-- Connect to an app and load its manifest into global Manifest.
-- Also return the name of the app we have connected to.
local new_manifest, app_name = get_manifest()
-- preserve existing order
-- 1. add new definitions in front
for _,name in ipairs(new_manifest) do
if not array.find(Manifest, name) then
table.insert(Manifest, 1, name)
end
end
-- 2. remove missing definitions
for idx=#Manifest,1,-1 do
local name = Manifest[idx]
if not array.find(new_manifest, name) then
table.remove(Manifest, idx)
end
end
return app_name
end