How to read a Bunch of files in a directory in lua -


i have path (as string) directory. in directory, bunch of text files. want go directory open it, , go each text file , read data.

i've tried

f = io.open(path) f:read("*a") 

i error "nil directory"

i've tried:

f = io.popen(path) 

i error: "permission denied"

is me, seems lot harder should basic file io in lua?

a directory isn't file. can't open it.

and yes, lua has (intentionally) limited functionality.

you can use luafilesystem or luaposix , similar modules more features in area.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -