ID:2111620
 
Code:
View_Logs(M as mob)
var/list/logs("")
logs.Add(file("/Logs/[M.key]/"))
var/log = input("What file do you want to view?") in logs
usr<<browse(file(log))


Problem description:
I'm trying to append all files in the directory '/Logs/[M.key]/' into the variable logs; then the user chooses the log they want to view which is sorted out by dates then, it opens the log in a browser for the user to read.
This isn't valid DM syntax (it even causes a compiler error):
var/list/logs("")

You can use flist() to get a list of all files directly under a given folder:
View_Logs(mob/M) // <-- you should probably limit this to players

var logs_folder = "Logs/[M.key]/"

var files[] = flist(logs_folder)

// exclude sub-folders
for(var/file in files)
if(findtextEx(file, "/", -1))
files -= file

var log_file = input(src, "What file do you want to view?", "View Logs") in files

// make sure to include the folder in the path to the file
src << browse(file("[logs_folder][log_file]"))