Changeset 72

Show
Ignore:
Timestamp:
05/10/10 19:53:07 (2 years ago)
Author:
Carsten
Message:

Added in-game console function pts2csv() to config.lua as documented at <http://www.cafu.de/wiki/appendix:pts2csv>.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • cafu/trunk/config.lua

    r61 r72  
    6666 
    6767 
     68function pts2csv(fileName) 
     69    if fileName:sub(-4, -1):lower()==".pts" then 
     70        -- Strip the .pts suffix, if present. 
     71        fileName=fileName:sub(1, -5); 
     72    end 
     73 
     74    -- Load and run the point file in order to obtain the Points table. 
     75    dofile(fileName .. ".pts"); 
     76 
     77    -- Write all points into a new csv file. 
     78    local csvFile=assert(io.open(fileName .. ".csv", "wt")); 
     79 
     80    csvFile:write('"time","x","y","z","heading","info"\n'); 
     81    for i=1, #Points do 
     82        csvFile:write("\"", table.concat(Points[i], "\",\""), "\"\n"); 
     83    end 
     84 
     85    csvFile:close(); 
     86end 
     87 
     88 
    6889-- sv_AutoAddCompanyBot=true; 
    6990-- cl_maxLights=20;