DarkingCheater Posted November 10, 2018 Posted November 10, 2018 Well, to read a txt file you need the directory and filename. Below you will have a function where it will open the file and read it and return the text of it. local open = io.open local function read_file(path) local file = open(path, "rb") if not file then return nil end local content = file:read "*a" file:close() return content end Example in the txt file that is located in the android Notes folder is stored in the text "TestRead" local open = io.open local function read_file(path) local file = open(path, "rb") if not file then return nil end local content = file:read "*a" file:close() return content end Text = read_file('/storage/sdcard0/Notes/File.txt') if Text == nil then print('The directory or file name is wrong') else print(Text) end will return "TestRead"
FTRMN Posted November 10, 2018 Posted November 10, 2018 All devices not truth road exam.. /storage/sdcard/Notes or /storage/Mfc041/Notes .. u understand ?
DarkingCheater Posted November 10, 2018 Author Posted November 10, 2018 2 minutes ago, goldenkaramel said: All devices not truth road exam.. /storage/sdcard/Notes or /storage/Mfc041/Notes .. u understand ? it was just an example you choose the directory
Recommended Posts
Archived
This topic is now archived and is closed to further replies.