I want to load the coordinate from the text file into the table? any refer here? thanks!
Label: corona android iphone ipad building error inmobi problem display screen View image tableView failed object physics touch button game lua config event listener |
How Can I loading the file to table?
You can use John Beebe's library or Crawlspacelib for that.
There are several other examples in the Share your code section.
Like this :)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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 |
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).
views:2283 update:2012/2/13 9:11:28
热门文章
GameCenter LeaderBoards and Achievements Enabled Through OpenFeint
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
send message and call to a person
Forum: Report Spam + PM
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
[SOLVED] Director ERROR: Failed to execute new( params ) function on 'screen1'
Too many (200) local variables
Corona SVG Level Builder released. Drag and drop physics level editor with Inkscape and SVG.
Small bug in Collectible Items example
Pivot Joints and apparent elasticity
Can't make removeSelf() delayed
相关文章
looking for a programmer for a new game
Purchasing Corona PRO broken??
Image Z order, Groups, and Director
Forum - Quote post still not there - Signatures
Linux support
Clear all objects from screen
tACKY - The Animals Can Kill You Music blog RSS App is now available!
[Physics] Applying Force Constantly - Gravity?
Video display object
Corona Cant Keep a Smooth 30fps - Animation Useless
Purchasing Corona PRO broken??
Image Z order, Groups, and Director
Forum - Quote post still not there - Signatures
Linux support
Clear all objects from screen
tACKY - The Animals Can Kill You Music blog RSS App is now available!
[Physics] Applying Force Constantly - Gravity?
Video display object
Corona Cant Keep a Smooth 30fps - Animation Useless
corona forums © 2003-2011