we can read the data from the file using file:read().
|
1 2 3 4 5 6 7 8 |
--Get the file from a document directory.If the file is on same directory of a main.lua Then no need to --specify system.DocumentsDirectory local path = system.pathForFile( "data.txt", system.DocumentsDirectory ) local file = io.open( path, "r" ) if file then local contents = file:read( "*a" ) print( "Contents of " .. path .. "\n" .. contents ) io.close( file ) end |
Incoming search terms:
- using lua file in document directory corona
- where is corona system documentsdirectory



