Static Analysis (Compile Time Error Checking)

Perkus

Prince
Joined
Oct 16, 2010
Messages
316
Location
Ontario, Canada
Hello,
I'm getting very tired of spending 2-3 minutes loading a late game save I'm testing with just to find trivial syntax and variable name errors in my code. It doesn't help that Civ5 crashes on every second reload from within the game with this save.

Is there anything simple to setup and use with ModBuddy that would do static analysis? I looked through http://lua-users.org/wiki/DetectingUndefinedVariables for a bit, but the stuff they refer to appear to be*nix O/S based.

What do you hard-core modders do? Are you just using the Tuner and reloading code on the fly? I find the Tuner... intimidating.
 
tuner and tests on duel size maps for fast reloads. there's a way to reload your lua (type include("yourscript") ), but its not really reload, its just reinclude, so it duplicates your stuff. eventually you need to reload the game.

there is logging that can be enabled (config.ini i think) that might show why there's a crash right away

overall though, the tuner is the way to go imo. why do you find it intimidating? there's tabs that you use to point and click for stuff, there's tabs that have cryptic debug memory stuff that you ignore, and then there is the console.

in the console you can test all the code you want to try out before putting it in a mod, meaning you plop in one liners there and find errors and only have to worry about logical or syntax errors in your main files later
 
I have the debugging on. It does help a lot for certain kinds of errors. Good idea about using duel-sized maps. I tried figuring out what the heck to do with the tuner a couple of weeks back. I played around a bit, and felt like I didn't understand 90% of what I was looking at. I tried finding some sort of manual for it, and the documentation seemed to be almost non-existent. So I gave up on it. I guess I should have another look.
 
I have the debugging on. It does help a lot for certain kinds of errors. Good idea about using duel-sized maps. I tried figuring out what the heck to do with the tuner a couple of weeks back. I played around a bit, and felt like I didn't understand 90% of what I was looking at. I tried finding some sort of manual for it, and the documentation seemed to be almost non-existent. So I gave up on it. I guess I should have another look.

it's a great tool, if anything download the tuner utility in my sig, check the code and you can see some basic stuff you can do with the console

outside of the console the unit/improvement/resource plopper along with the city editor is very handy for setting up a test environment really fast, or just for plain old cheating too ;)
 
I guess luac 5.1 should work for practically all of the Civ5 lua files. I doubt Firaxis has added or changed stuff on the C++ side to the extent of adding opcodes and such that would break the compiler
 
Back
Top Bottom