I noticed that you did not mention Javascript in your personal experience, so likely you do not have much exposure to
prototype based programming.
Actually, I find LUA quite elegant, LUA is very simple in some ways, but provides quite a powerful set of features. LUA is not a traditional OOP language like Java, C++ or C# -- and this can be a benefit to us modders, but can also make our job harder. Since LUA is not a traditional OOP, it does not provide many mechanisms for encapsulation, this means LUA tends to expose it's parts, specifically the table structures that make up most of LUA's organization. On the making our job harder side, LUA does not have traditional Class structures like Java or C#. Most class structures are implementation dependent and it is up to the developer (in this case Giants) on how they actually implement things like constructors, destructors, inheritance, etc.
Here is a really good online book --
Programming in LUA -- I would recommend reading at least Part 1 and Part 2. I actually think Part 2 is more important to understand, but Part 1 is laying the groundwork to understand Part 2. Just a note, this book is somewhat dated focusing on LUA 5.0, but do not worry about that, the Giants engine uses LUA 5.1 which is also somewhat dated.
As a bit of incentive, if you look at
Chapter 14, you will see code that can help you discover global variables (such a g_currentMission) in a LUA environment. That said, without understanding metatables (
Chapter 13) you likely will still have a hard time finding all of the global variables. Jumping straight into Chapter 13 may be confusing though (particularly if you do not have experince with Javascript or another prototype based programming language), so you might want to read through the previous chapters first.
Being able to find and examine global variables can be a very powerful tool if you wish to pursue farming simulator modding. In fact, in the previous example I provide for printing prices, there were a number of global variables,
g_currentMission,
g_i18n, and even
FillUtil is a global variable. Yes, FillUtil looks like a class and from an implementation standpoint it could be said that FillUtil is a class, but FillUtil is actually a LUA table under the covers. Since FillUtil is a table you can use
printTableRecursively to examine it. You will find an undocumented sub-table called
fillTypeIntToName which was used in the example to lookup up the fill type name.
BTW, I did not discover the fillTypeIntToName through introspection of global variables, I found it through inspection of other mods. This is the most powerful way to learn things, look at previous examples or mods. But, once you find something, it is nice to have additional tools too look even deeper.
Once again, onto your question:
You said GIANTS didn't document g_currentMission, but is there a list of these tables somewhere, or is g_currentMission basically all of the stored data?
Yes, there is a list of tables somewhere -- in the LUA global environment space. Probably not the answer you wanted. I would say make note of any table starting with "g_" as you are looking throught mods, this seems to be a naming convention followed by Giants for global tables. Also, as you get familiar with LUA, you may be able to write a function that searches the global environment for particular information.
Second answer, g_currentMission is an important table, I don't think it will ever be documented because it is a bit of a dumping ground for the current map/tutorial you are playing. For example, one of the things you will find in g_currentMission is a structure storing gold nugget informtion for the gold crest valley map, I suspect it would NOT be there for sosnovka map. Another example, g_currentMission is also used in the tutorials, but I suspect it would be a very abbreviated version by comparison to playing an actual map like gold crest valley. Finally, even multiplayer affects things that are available in g_currentMission, once again gold nuggets are not available in multiplayer gold crest valley.
I would recommend printing out g_currentMission to get a feel for it, but the first time you see g_currentMission, it will likely be simliar to the first time you looked at the GDN documentation, there will be a lot of information and you may not know where to start.
I have already said this, but previous examples are the best place to start, most of my initial knowledge coming from mods that I cracked open and reading the LUA code inside them. Then, when you start getting a feel for how Giants has organized it's code, you will more easily find the right places to look in both the GDN documentation and inside the LUA global environment.
Lastly, I will say this, you do NOT have to know LUA to do modding in farming simulator. The engine for farming simulator is VERY data driven through XML files and even more XML files -- I3D files are XML files created through the Giants Editor (GE). I have focused on LUA because you seem to want to understand and possibly change the way the script works, instead of configuring a new item that works within the framework Giants has provided. That said, do not ignore these other things, quite often data is hidden in these XML (and I3D) files. Understanding the XML can help you understand the LUA script and vice versa. You may want to go through all the
video tutorials provided on the GDN site even if you are not that interested in making a new map or a new piece of equipment, understanding these things will help you understand the scripting.