Merge luaML.love

This commit is contained in:
Kartik K. Agaram 2023-06-19 10:20:31 -07:00
commit e479baf449
1 changed files with 4 additions and 6 deletions

View File

@ -58,7 +58,8 @@ function live.load_files_so_far()
end
end
end
-- load files from save dir
-- list files to load in save dir
-- (ignore the repo because we might have deleted definitions)
for _,filename in ipairs(love.filesystem.getDirectoryItems('')) do
if io.open(love.filesystem.getSaveDirectory()..'/'..filename) then
local numeric_prefix, root = filename:match('^(%d+)-(.+)')
@ -70,17 +71,14 @@ function live.load_files_so_far()
end
end
table.sort(Live.filenames_to_load)
live.load_all(files)
end
function live.load_all()
-- load files from save dir
for _,filename in ipairs(Live.filenames_to_load) do
--? print('loading', filename)
local buf = love.filesystem.read(filename)
assert(buf and buf ~= '')
local status, err = live.eval(buf)
if not status then
return err
error(err)
end
end
end