|I have been looking at the scripting documentation and several open source mod scripts out there. I am noticing several things in the open source mod scripts, that aren't listed in the API documentation for FS19. Am I missing something or how does one find these things?
There are more in other scripts. I looked in the API docs for the Utils and none of those are there.
|Bilbo Beutlin (BBeutlin)||27.11.2019 00:27|
|The FS documentation has always been incomplete and will probably remain so.
Giants certainly doesn't have the capacity of a big IT company with its own documentation department.
It is also a matter of opinion what exactly you need. A certain amount of self-initiative can be assumed.
In any case, the documentation is still being worked on. Those who visit GDN frequently will have noticed constant changes and additions.
|Gtx | Andy (GtX_Andy)||27.11.2019 00:35|
|You could print the function list for 'Utils' if you wish to see what is available.
'Utils.prependedFunction' is simple and does as the name suggests. This will prepend an existing function with the given function or if the original function does not exist then only the new one will be returned. So if you need to execute something before the original function you use this.
Basically some of the knowledge on how to use undocumented functions comes from previous versions of the game where this may have been documented or from years of scripting for FS. Most utility functions including for 'MathUtil' for example are just helper functions you would write when working with lua or any other scripting language.
For example these function would be as follows:
function MathUtil.clamp(value, minValue, maxValue)
return math.min( math.max( value, minValue), maxValue)
function Utils.getNoNil(value, spareValue)
if value == nil then
Sadly after all these years since I started modding and scripting in FS13, I do not see the documentation getting better or more open which is sad as it is the script mods that really build on the base game and always will and it is not like the code is any good outside of the Giants Engine ;-)
|Bilbo Beutlin (BBeutlin)||27.11.2019 01:14|
|There's another point, espec. concerning LUADOCs:
Developers are basically lazy *g* (I am 30+ years in software development myself)
The one who writes the code doesn't need explanations/comments. It's additional work and requires much self-discipline to make the code easy understandable for others. But a simple raw code without explanations is not suitable for publishing as documentation. It must be overworked, what requires time and manpower.
And btw: modders are just as lazy. I've rarely seen scripts with detailed comments, very often even completely without them. ;)
|Gtx | Andy (GtX_Andy)||27.11.2019 03:22|
|This is so true, I personally only leave notes on things that may not make sense at first glance.
But before FS I always liked to leave notes in Python and C. Maybe this is because lua is a much simpler language to use.
Mind you in FS I also like to try and simplify if needed and also look for the best way performance wise to do things, sadly the attitude 'If it works it is fine' is the norm now and to me that is a bad attitude. It can be hard for developers to do this as time is money and labour may be limited but hobby modders don't have much of an excuse. lol ;-)
But yep, some are very lazy :rofl
Note: Log in to post. Create a new account here.