I am trying to get a program to list the files in the current directory. The Wiki says that ls() outputs a table of the folder's contents, but it gives me a [NIL] for every item in the folder. Why is that? Does anyone know how to do this?
P#54226 2018-07-17 07:40 ( Edited 2018-07-17 12:45)
I think you're trying to index (incorrectly) from within the print command.
I've just tried this and it worked:
files=ls() cls() print("count: "..#files) for file in all(files) do print(file) -- no need to index here, as the "for" gives you the actual value end
P#54227 2018-07-17 07:51 ( Edited 2018-07-17 11:51)
[Please log in to post a comment]