Reading mod data and write into files (for modinfo.adune.nl)

Reading mod data and write into files (for modinfo.adune.nl)

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Reading mod data and write into files (for modinfo.adune.nl)

Post by TradeMark »

Since everything is going to be lua scripted, eventually...

Could someone tell me how to dump all the data of mods settings into some files similar as the TDF format is, or even better: a PHP array format? Or could someone make it? i dont know a shit about lua scripting...

Trepan, or someone promised to do this like a year ago when i asked, but i havent heard anything about this after that day...

It would be best if i could run spring in command line, and add some parameter to tell spring to read the mod data, with a line like:

Code: Select all

spring.exe -m "BA65.sd7" -o "C:/modit/ba65/"
Then i could make more flexible online mod database where anyone could upload their mods, and i could just run that command, and voila!


Hmm, should this be in feature requests...?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Re: Reading mod data and write into files (for modinfo.adune.nl)

Post by Peet »

The advice of a lua nub:
Could you not read through the unitdef tables and save their contents in whatever format you wish?
trepan
Former Engine Dev
Posts: 1200
Joined: 17 Nov 2005, 00:52

Re: Reading mod data and write into files (for modinfo.adune.nl)

Post by trepan »

Code: Select all

r6154 | trepan | 2008-07-12 12:18:39 -0300 (Sat, 12 Jul 2008) | 9 lines

- added the lua2php.cpp script
  - a decent test for the unitsync LuaParserAPI
  - saves all "defs.lua"definitions to a php compatible file

- added the LuaTable::GetType() calls
  (they return the lua.h type enums)
MelTraX
Posts: 470
Joined: 02 Jan 2007, 16:18

Re: Reading mod data and write into files (for modinfo.adune.nl)

Post by MelTraX »

In case you want a PHP solution, I wrote a Lua table parser the last days for the ladder. Of course it can't execute Lua, it just reads a static table (like ArchiveCacheV7.lua or ModOptions.lua).

Tell me if I missed a dependency function or if it doesn't work for any file you test.
Attachments
LuaParser.txt
forum doesn't allow .php
(4.71 KiB) Downloaded 20 times
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Reading mod data and write into files (for modinfo.adune.nl)

Post by TradeMark »

trepan wrote:

Code: Select all

r6154 | trepan | 2008-07-12 12:18:39 -0300 (Sat, 12 Jul 2008) | 9 lines

- added the lua2php.cpp script
  - a decent test for the unitsync LuaParserAPI
  - saves all "defs.lua"definitions to a php compatible file

- added the LuaTable::GetType() calls
  (they return the lua.h type enums)
oh nice!

Now, could someone compile that for windows?

Does it support the commandline thing i suggested? If not, i dont have any real use for it...
MelTraX wrote:In case you want a PHP solution, I wrote a Lua table parser the last days for the ladder. Of course it can't execute Lua, it just reads a static table (like ArchiveCacheV7.lua or ModOptions.lua).

Tell me if I missed a dependency function or if it doesn't work for any file you test.
Cool, I'll try that later with lua maps, might be only usage for that, since nobody hasnt (yet) made any stupid programming in them.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Re: Reading mod data and write into files (for modinfo.adune.nl)

Post by AF »

At one point i worked on a json exporter program based on something trepan wrote
Post Reply

Return to “Lua Scripts”