how to create tables for XML, then read content using Lua?

Bosparan

Chieftain
Joined
Oct 27, 2014
Messages
23
Hi guys,

I've been wondering:
Is there a way to create a new table, whose content I can fill using XML in the same way I modify original content (add units, change buildings, etc.)?

And if that's possible, can I use Lua to read values from that table? How?

Cheers,
Bosparan
 
You would have to use SQL to create a new table, something along the lines of
Code:
CREATE TABLE table  (someInt INTEGER, someText TEXT, etc..);
with all of your columns and their types listed in the parentheses. Then, when you add something the SQL would be something like
Code:
INSERT INTO table  (someInt, someText, etc..) VALUES (your values, comma separated, go here);
And yes, it can be read from lua. Look at the TableSaverLoader lua modcomp for civ5 for a general idea of how that works.
 
Hi Is612,

thanks for the advice. I've been so focused on lua and xml, I forgot about SQL. Works like a charm and I can use standard XML content files to add rows (which is good, especially for interop, if someone wants to extend my mod.
For reading the content, I've found the DB class to be quite helpful. Now I just have to stop ramming my head against the wall on making lua side things work, but that's my problem :)

Cheers,
Bosparan
 
Top Bottom