Category | Farming Simulator 17 |
Created | 25.01.2017 16:20 |
Tim Derks (timmiej93) | 25.01.2017 16:22 |
---|---|
So I have my own Lua script for a placeable, which includes filltriggers. For custom control over these filltrigers, I have implemented the FillTrigger:new(mt) function in my own Lua file. Since I'm still calling it "FillTrigger:new(mt)", does this mean that EVERYTHING that creates a new filltrigger uses this function, or does this only apply for my own Lua file? |
Bilbo Beutlin (BBeutlin) | 25.01.2017 17:26 |
---|---|
If I understand right, you have a LUA like: .. myMod:func1() .. myMod:func2() .. FillTrigger:new(mt) .. That will give at least an error, since the "FillTrigger:new()" function is already used/defined within the "FillTrigger.lua" and second you can only use objects/functions which are sub-objects of your myMod:xyz class/array, what you have declared earlier with "myMod = {};" With this error your script won't be loaded at all. |
Tim Derks (timmiej93) | 25.01.2017 17:34 |
---|---|
I indeed have a Lua file like you describe. The strange thing is that this has worked for a LONG time, I have been testing like this for weeks, and it worked, including all the changes I implemented. However, now I'm getting an error about a FillablePallet, that seems to try to use the FillTrigger:new() function inside my Lua file. I can also see that the function is called multiple times during loading, even when my own mod has not been placed on the map yet. How should I go about this then? I need pretty much all the functionalities of a default FillTrigger, but with a few minor changes that need to be made inside its 'new' and 'load' function. Should I create functions like "MyMod_FillTrigger:new(mt)" for all the functions as sen in the LUADOC? Would that even work properly? |
Bilbo Beutlin (BBeutlin) | 25.01.2017 17:43 |
---|---|
Curious. I had expected, it wouldn't even load at all. Seems it overwrites the standard function. Anyway - you have to call your function "myMod:new(mt)" to avoid conflicts. Where "myMod" is the name you defined at beginning. |
Tim Derks (timmiej93) | 25.01.2017 18:54 |
---|---|
You were talking about the "FillTrigger.lua" file earlier. Is that complete file available somewhere? I think copying from there is a lot easier than copying from the GDN. |
Bilbo Beutlin (BBeutlin) | 26.01.2017 10:36 |
---|---|
I don't know about other sources than these on GDN. However they are not 100% complete - a few code is missing. Honestly that's a contradiction to Giants' declaration about learning by studying the code. How should one if the code is incomplete? For the FS15 the complete LUAs were published earlier, but don't exist anymore. People who have still copies of it, can easily compare and complete the missing parts. |
Colin Simpkin (Unknown) | 26.01.2017 13:00 |
---|---|
All the scripts are available you just have to know where to look http://web.archive.org/web/20161102012201/http://ls-mods.de/scriptDocumentation.php http://web.archive.org/web/20141217120135/http://www.ls-mods.de/scriptDocumentation.php http://web.archive.org/web/20130117091845/http://www.ls-mods.de/scriptDocumentation.php http://web.archive.org/web/20101228155306/http://ls-mods.de/scriptDocumentation.php Courtesy of akuenzi on FS-UK.com |
Note: Log in to post. Create a new account here.