FAQ  •  Login

LuaCSV [Export data from LUA to Excel]

<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 15, 2015 1:17 am

LuaCSV [Export data from LUA to Excel]

Ok this is a first version of the Excel exporter that I promised.

I mostly wrote it for myself but it's also meant for people who run competitions and want to copy the values to Excel, as proposed in this thread. It currently only works with the (non Steam) Launcher version 1418. I will make it work for the current version once that is available to non Steam users. However even if you have updated to Steam it will be very handy to see an overview of your past designs. Of course I assume everyone made a backup of their designs, otherwise you're screwed :)

It currently extracts the following values:
Cars: Model Name Year Weight Configuration Cylinders Displacement Peak Power Torque Rpm Top Speed
Engines: Model Name Year Aspiration Configuration Cylinders Bore Stroke Displacement Peak Power Torque Rpm Weight Compression CamProfile Mixture* IgnitionTiming Compressor Turbine ARR Ratio Boost
*it currently cannot export fuel mixture because I did not find it

THE PROGRAM IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT YOUR OWN RISK. IN NO CASE WILL THE AUTHOR OR THE AGENTS OF THE AUTHOR BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE
yadda blabla etc. You can do with the program and source code whatever you want, but at our own risk and responsibility.

Here is the sourcecode (C#) http://www.global-explorer.de/LuaCSV/Program.cs
It links to LuaInterface which can be downloaded here http://luaforge.net/projects/luainterface/

The program presumes that you put your models (cars) into the "Models" subfolder. Likewise engines go into the "Engines" subfolder. All required folders and files are already there, you only need to copy YOUR cars and engines to the appropriate subfolderr.
Run the program LuaCSV.exe . It is rather slow so it will take several seconds, that's normal.
If the program says OK, the results of the export will have been written into "models.txt" and "engines.txt"
Now open those files with a text editor and copy everything ( CTRL-A then CTRL-C )
paste everything into Excel [ CTRL-V ]. I provided two Excel files with the correct column headers for models and engines accordingly
You should know what you can do from there
And dont forget, if you want rows and columns exchanged, you can simply transpose the tables

models.jpg
models.jpg (321.58 KiB) Viewed 9544 times

engines.jpg
engines.jpg (276.58 KiB) Viewed 9544 times
Last edited by BurningBridges on Sat Apr 04, 2015 9:29 pm, edited 14 times in total.
<<

NexxusDrako

User avatar

Turbocharged
Turbocharged

Posts: 55

Joined: Mon Nov 26, 2012 5:35 am

Location: Melbourne, Australia

Cars: Mum's '00 Ford Falcon

Post Sun Mar 15, 2015 1:33 am

Re: LuaCSV [Export data from LUA to Excel]

Rather than post the code here, would you mind uploading it to github? Might be less heavy on text which inflates the page's load time.

Also, I assume it's open source, so you should be able to get it there for free. :)

EDIT: I also want to hack around on it. :P
<<

conan

User avatar

Naturally Aspirated

Posts: 862

Joined: Thu Oct 28, 2010 1:13 am

Post Sun Mar 15, 2015 1:34 am

Re: LuaCSV [Export data from LUA to Excel]

This is actually pretty neat! :) When you finish converting it to current build, then it'd be really rather excellent.
uranium tungsten oxygen octo-thulium
<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 15, 2015 1:41 am

Re: LuaCSV [Export data from LUA to Excel]

NexxusDrako wrote:Rather than post the code here, would you mind uploading it to github? Might be less heavy on text which inflates the page's load time.

Also, I assume it's open source, so you should be able to get it there for free. :)

EDIT: I also want to hack around on it. :P


Ok, I replaced the embedded sourcecode with a simple link so the page is not slowed down. As far as I am concerned the code is free to copy and modify and so you can do all that yourself if you want. No restrictions to authorship etc of my skript, but keep in mind that LUAinterface has its own license (MIT) and is of course not affected by it.

Also if you are really interested you might as well wait until I make a Steam version. Overall everything can be made simpler and faster when I understand the format better.

conan wrote:This is actually pretty neat! :) When you finish converting it to current build, then it'd be really rather excellent.


Sure, but first it must release it to all users.
Last edited by BurningBridges on Wed Mar 18, 2015 1:27 pm, edited 1 time in total.
<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 15, 2015 2:04 am

Re: LuaCSV [Export data from LUA to Excel]

I see there are still some mistakes in the exported values, engine power and torque seems to to be wrong some times.
will be fixed in time.
<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 15, 2015 9:11 am

Re: LuaCSV [Export data from LUA to Excel]

I made a pass on the power as I did not understand the numbers at first. The confusion with power was simply that unit was kilowatt and I expected it to be hp. I now convert to horsepower since I'm more used to that. Values seem perfectly ok now.

I also added displacement. Unit is cubic centimeters. If you're from the US, I am totally not used to square inches. But 1000 cubic centimeters = 1 liter. Not just roughly. But exactly 1000 :) So it should not be hard to figure out.

I also made output to .txt instead of csv, so it's easier to open them if you have file attachments.
<<

Reaper392

2-Star Beta Tester
2-Star Beta Tester

Posts: 470

Joined: Mon Dec 09, 2013 7:11 am

Post Sun Mar 15, 2015 9:53 am

Re: LuaCSV [Export data from LUA to Excel]

Sorry to potentially drag this off topic, but what is this magical LuaInterface library, is there one for C++ and how hard is it to install?

I didn't even consider looking for libraries which let C++ read lua tables because of the horror show that was manually compiling and installing the OpenCV libraries in a way that would work with visual studios. When I tried doing something vaguely similar to this last year I was trying to read and alter automation's engine files by reading the lua file as a text file, extracting the relevant parts by searching for specific text strings, then rewriting the entire file again with any modifications needed which, as you can imagine, was horrible
<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 15, 2015 10:16 am

Re: LuaCSV [Export data from LUA to Excel]

This Luainterface is for .NET (there is a link provided) there should be one for Cpp too, I am sure. I use C# because installing dlls in a project is a breeze. Usage is a bit tricky because the functions return type object and you must figure out wether you can cast it to which type. Hence the repetitive boilerplate and occasional stupid casts like (int)(double). Now that I have done it once I think I can make it much simpler by writing my own parse(*type) routines, and making a much leaner script, instead of doing it over and over.
I thought about parsing text too but that would become extremely awkward. Not recommended.
It's currently still a mess because the values are strewn over different tables, therefore I often parse for the max value. Not perfect, but it works.
<<

UMGaming

User avatar

Supercharged
Supercharged

Posts: 486

Joined: Sun Nov 16, 2014 4:50 pm

Location: Auckland NewZealand

Cars: None :(

Post Sun Mar 15, 2015 1:57 pm

Re: LuaCSV [Export data from LUA to Excel]

when are you expexting to update it so its steam compatible
<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 15, 2015 8:22 pm

Re: LuaCSV [Export data from LUA to Excel]

You must ask Camshaft Software when they make it available to existing customers, not me.
<<

RobtheFiend

Supercharged
Supercharged

Posts: 640

Joined: Wed Oct 10, 2012 12:35 am

Location: Sweden

Cars: Opel Astra -99 1.6 16

Post Mon Mar 16, 2015 5:14 am

Re: LuaCSV [Export data from LUA to Excel]

And for 'mericans out there: 1 CID = 16.387 cc and 1 cc = 0.061 CID
<<

Reaper392

2-Star Beta Tester
2-Star Beta Tester

Posts: 470

Joined: Mon Dec 09, 2013 7:11 am

Post Sun Mar 22, 2015 7:14 am

Re: LuaCSV [Export data from LUA to Excel]

To save people the hassle of copy/pasting things from a text file to an excel file, have you considered exporting the results into a .csv file? That way excel could open it straight away, albeit without any font formatting. I know there's a way of exporting directly to a proper excel file, but I did that several years ago and cant remember how :P
<<

BurningBridges

User avatar

Naturally Aspirated

Posts: 378

Joined: Tue Oct 08, 2013 11:56 pm

Location: Berlin

Cars: Golf

Post Sun Mar 22, 2015 7:53 am

Re: LuaCSV [Export data from LUA to Excel]

Actually, it is creating a csv file from the beginning. The text output is already a csv file with tabs as separators, but its a pain in the rear to use that route.
Importing it as a CSV file is actually creating more hassle than the 2 simple copy paste steps described (CTRL-A, CTRL-C, CTRL-V). Believe me, I created it for myself most of all, and I use Excel extensively, so why would I make it harder on myself.
<<

TrackpadUser

User avatar

2-Star Beta Tester
2-Star Beta Tester

Posts: 877

Joined: Tue Dec 09, 2014 3:20 pm

Location: Montreal, Canadia

Cars: 2006 Suzuki Swift+

Post Sun Mar 22, 2015 8:24 am

Re: LuaCSV [Export data from LUA to Excel]

Best way to export it to a proper Excel file would be with a VBA script made in Excel.

But, as you said, you can just open the CSV with Excel and then save it as an Excel file.
<<

Reaper392

2-Star Beta Tester
2-Star Beta Tester

Posts: 470

Joined: Mon Dec 09, 2013 7:11 am

Post Sun Mar 22, 2015 9:34 am

Re: LuaCSV [Export data from LUA to Excel]

BurningBridges wrote:Actually, it is creating a csv file from the beginning. The text output is already a csv file with tabs as separators, but its a pain in the rear to use that route.
Importing it as a CSV file is actually creating more hassle than the 2 simple copy paste steps described (CTRL-A, CTRL-C, CTRL-V). Believe me, I created it for myself most of all, and I use Excel extensively, so why would I make it harder on myself.

Fair enough. I just thought it might make things slightly easier for incredibly lazy people like me :P
Next

Return to Community Challenges & Competitions

Who is online

Users browsing this forum: No registered users and 22 guests