Hi,
I’d like to write a LUA script to DT what has a function to return with the list of files in a specific directory.
My problem is that if I run the script in a debugger (ZeroBrane studio) it works well, but DT won’t load the script.
If I remove the “lfs = require “lfs”” part DT loads it, but of course the function doesn’t works.
How can I use the “lfs” in DT?
lfs = require "lfs"
local myFiles = {}
local function ListFiles(directory)
local dirFiles = {}
for file in lfs.dir(directory) do
if file ~= "." and file ~= ".." then
print("1file in dir: "..file)
table.insert(dirFiles, file)
end
end
return dirFiles
end
-- example usage
myFiles = ListFiles("D:\\Downloads\\")
Thank you