Posted 21 March 2014 - 11:09 PM
So, I'm working on a program to read the content of other files on the system and print them to the screen (or a nearby monitor, but that can be done easily from the shell lol.)
But the main thing I want the program to do is accept arguments lol. For example, the reader program might be called "zreader" and the file I'm trying to open is called "zfile" and is found on a disk (so "disk/zfile"). As soon as I boot the computer I want to be able to type in "zreader disk/zfile", and I'm wondering if/how I could do that without making a custom API, but I wouldn't be completely opposed to a custom API.
My current code is as follows
Of course, I may have just been an idiot and completely miswrote the first line, and I make no claims to the contrary lol.
And as always, any helpful input would be appreciated. Thank you.
Sincerely,
digitalEntity.
But the main thing I want the program to do is accept arguments lol. For example, the reader program might be called "zreader" and the file I'm trying to open is called "zfile" and is found on a disk (so "disk/zfile"). As soon as I boot the computer I want to be able to type in "zreader disk/zfile", and I'm wondering if/how I could do that without making a custom API, but I wouldn't be completely opposed to a custom API.
My current code is as follows
a = args{...}
if fs.exists(a) then
local h = fs.open(a, "r")
local b = h.readAll()
print(B)/>/>
else
print("File not found.")
end
Of course, I may have just been an idiot and completely miswrote the first line, and I make no claims to the contrary lol.
And as always, any helpful input would be appreciated. Thank you.
Sincerely,
digitalEntity.