I got this error recently:
lua: Lua Testing.lua:36: bad argument #1 to 'read' (invalid option)
stack traceback:
[C]: in function 'read'
Lua Testing.lua:36: in main chunk
[C]: ?
And I'm not sure why. Here's my code:
file = assert(io.open("test.txt", "r"), "no file.")
print(io.read(file))
io.close(file)
To explain a few things, I'm using assert to make sure the file is there and it is. I'm pretty new to Lua. I've googled about this error and I came up with nothing that helped me fix this.