How Can I loading the file to table?

I want to load the coordinate from the text file into the table? any refer here? thanks! [import]uid: 22631 topic_id: 21523 reply_id: 321523[/import]

You can use John Beebe’s library or Crawlspacelib for that.
There are several other examples in the Share your code section. [import]uid: 13553 topic_id: 21523 reply_id: 85185[/import]

Like this :slight_smile:

[code]
function loadTable(fp, baseDirectory)
local path = system.pathForFile( fp, baseDirectory or system.DocumentsDirectory)

file = io.open(path, “r”)

local myTable = {}

if file then
myTable = json.decode( file:read("*a"))
io.close(file)
return myTable
else
return nil
end
end

–To use
loadTable(“myTable.data”) – for instance
[/code] [import]uid: 84637 topic_id: 21523 reply_id: 85225[/import]

Danny’s example is spot on, except that it requires the data being read to be stored in JSON format (which I highly recommend you use to store your data anyway).

[import]uid: 19626 topic_id: 21523 reply_id: 85254[/import]