Found this from my computer - I have probably copied it from
http://stackoverflow.com)
(show all filenames in current script path)
Code:
function msg(m)
return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end
function get_script_path()
local info = debug.getinfo(1,'S');
local script_path = info.source:match[[^@?(.*[\/])[^\/]-$]]
return script_path
end
-- get "script path"
script_path = get_script_path()
-- Lua implementation of PHP scandir function
function scandir(directory)
local i, t, popen = 0, {}, io.popen
for filename in popen('dir "'..directory..'" /b'):lines() do
msg(filename)
i = i + 1
t[i] = filename
end
return t
end
file_table = scandir(script_path)
("cmd dialog" seems to appear - don't know if there's a way to prevent that)