Fix bug in printing MSU-1 track playback messages
[lsnes.git] / src / genfilelist.lua
blob058df649c859bc5d7a0f511e7a978b9dcc4e4136
1 #!/usr/bin/env lua
3 emit=function(filename)
4 local prefix, file, line, err, word;
5 if string.match(filename, "%.%./(.*)") then
6 return;
7 end
8 prefix = string.match(filename, "(.*/)[^/]*");
9 if not prefix then
10 io.stdout:write(" " .. filename);
11 return;
12 end
13 file, err = io.open(filename, "r");
14 if not file then
15 error(err);
16 end
17 s = "";
18 for line in file:lines() do
19 for word in string.gmatch(line, "%S+") do
20 s = s .. " " .. prefix .. word;
21 end
22 end
23 io.stdout:write(s);
24 end
26 for i=1,#arg do
27 emit(arg[i]);
28 end
29 print("");