I am trying to open a text file within my Lua script that is launched from Wireshark. However, it is not clear how to specify the filename as an absolute path or where the file should be stored. local csv_file = assert(io.open("AP_Batch.csv", "r")) When this executes I get "nil" back. I tried the following (with the same file copied into C:\temp) local csv_file = assert(io.open("C:\Temp\AP_Batch.csv", "r")) Where does Wireshark/Lua expect the current working directory to exist. I've copied the same file into Wireshark's installation folder, my home directory. Could someone enlighten me what folder I should place the file or how to specify a full Windows style path. EDIT: I tried C:\\Temp\\AP_Batch.csv, but this failed. The error dialog tells me "No such file of directory" and displays c:\Temp\AP_Batch.csv as what it tried to open asked 14 May '15, 12:08 carlwain74 edited 14 May '15, 12:14 |
2 Answers:
Some headway on this issue - File turned out to be named AP_Batch.csv.csv in Windows :-( However, I would still like to know where Lua and Wireshark expect files to exist if no path is specified answered 14 May '15, 12:55 carlwain74 |
You can refer this lua file io If no path is specified then io.open API bydefault takes that path where your .lua file is created for example if you have created sample.lua as below and you are trying to read test.lua from that
then test.lua should be in that directory where your sample.lua is created and for the file which is in another directory you can define the path like io.open("D:\lua.txt,"r") answered 14 May '15, 21:15 ankit |
ok sample.lua is located in the Wireshark folder. I confirmed that without a path it opens the file in this location.