GE Lua Documentation

Press F to search!

graphWithCSV

Definition


-- @/lua/common/guihooks.lua:149
local function graphWithCSV(filename, ...)
  local values = graph(...)
  if not csvfile then
    local keys = {}
    for _,v in ipairs(values) do
      table.insert(keys, string.format(v[4]=="" and "%s%s" or "%s (%s)", v[1], v[4]))
    end
    csvfile = require('csvlib').newCSV(unpack(keys))
    csvfilename = filename or string.format("graphcsv.%s.csv", os.date("%Y-%d-%mT%H_%M_%S"))
  end
  if csvfile then
    local row = {}
    for _,v in ipairs(values) do
      table.insert(row, v[2])
    end
    csvfile:add(unpack(row))
  end
end

Callers

@/lua/vehicle/input.lua
    false,
    --guihooks.graphWithCSV("understeer.csv"
    --,{"currG", currG, gmax, "G"}