My first LUA mod, need some advice

DeclanTKatt

Chieftain
Joined
May 29, 2011
Messages
19
Location
Chicago, IL
Hello,

I hope I am posting this in the correct forum, and that someone will stumble across it. Anyways, I'm current working on my first mod for Civ 5 (first ever, actually) and although I don't know lua at all, I'm starting to kinda piece it all together.

Anyways, suppose I wanted to create a really simple mod where all I did was take a .lua file that is already in the game such as:

assets\UI\InGame\CityView\CityView.lua

and all I did to it was remove one line of code from the file, and that's it. Sounds easy enough, but here's the question.

The only way I know to get this to work, is to copy over the original .lua to the ModBuddy, remove my desired line of code, save the new .lua, and set it's "Import to VFS" to true.

But this means that I'm practically feeding in an identical .lua into the game and it would not be compatible with any other mods that attempt to alter this particular .lua since my VFS has been set to true.

Is there anyway that I can just simply remove a line of code from a .lua without having to reiterate the entire file? This would be analogous to just doing an <Update> to an XML file.

Any help would be appreciated. Thanks alot!
 
But this means that I'm practically feeding in an identical .lua into the game and it would not be compatible with any other mods that attempt to alter this particular .lua since my VFS has been set to true.

Is there anyway that I can just simply remove a line of code from a .lua without having to reiterate the entire file? This would be analogous to just doing an <Update> to an XML file.

Nope, your understanding is correct. XML feeds into the database so it is easy to make small changes that are usually (but not always) compatible with other mods. But the Lua is directly interpreted and the smallest replaceable chunk is an entire file.
 
Also, to make it even worse, since you're copying the entire Lua file:

If the game's developers edit that file themselves (say, in a patch), then you'll need to merge your changes with theirs by hand. If you're talking about removing a single line then this isn't too hard, but if you're doing something more involved, like tweaking all of the numbers in AssignStartingPlots.lua, it's impractical.

And the only way you'll even know they changed the file is by carefully checking the Last Modified dates on every Lua file you tweak. So if you're going to do this, I HIGHLY recommend making a backup copy of the entire Assets directory, and downloading a comparison tool like WinMerge so that you can directly compare pre-patch and post-patch versions of the official files.
Actually, that's good advice even if you're just doing XML database changes.
 
for comparing data across files I actually prefer the compare plugin for Notepad++
 
Back
Top Bottom