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?
Thanks!
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 |
[Please log in to post a comment]