1
I’m trying to make a small script, but I’m facing some difficulties
local lab = nil
local f = io.open("/input-lab.txt", "r")
print(f)
I wanted to open a file that is in the same directory as the script and be able to read its data, let’s say input-lab.txt
had the following data
111101
100001
101101
101001
101111
So I wanted this file somehow and to be able to generate a string
based on it kind
"111101\n100001\n101101\n101001\n101111"
But I can’t get the script to read the file in the same directory, how do I do this?
in the directory where the script is, or in the current directory ? if it is in the current directory is easy, just put "input-lab.txt" or ". /input-lab.txt"...if it is specifically in the script directory I think there is no easy way (remember that you can be in the /x/y/x directory and the script is in the /a/b/c directory)
– zentrunix
what would be the current directory is as I know?
– cand