So I have this weird bug somewhere in my new mod that results in a crash to desktop.
Weird thing about it is that it just appears every now and then.
Steps to reproduce:
1) download the zip that includes savegame and the related wip-mod ( I also use treefarm + anti-pollution, but they should not have any influence here)
2) load the save
3) wait approx 10 seconds
4a) if a message is printed => bug did not appear, try again
4b) else, ctd
download:
https://www.dropbox.com/s/figv2grtuvgv01u/BR.zip
[0.9.3] CTD when using pointer to method of LuaObject
Re: [0.9.3] CTD caused by bug in modscript
Thank you for the report, the problem is in the usage gp (pointer to method to game.player.print), we can try to fix it to not crash, or at least give better error.
Until than, I advice using game.player.print instead of gp
Until than, I advice using game.player.print instead of gp
Re: [0.9.3] CTD caused by bug in modscript
Interesting , I did not expect that this is the reason. Avoiding it is so easy.
So does it affect only the pointer to the print-function or function-pointer in general?
So does it affect only the pointer to the print-function or function-pointer in general?
Re: [0.9.3] CTD caused by bug in modscript
Function pointers are tricky in general. The problem is, that this was pointer to function of factorio Lua Object. The game object is persistant so the gt works, but the player object is created inside the construction game.player and removed soon later, so the pointer to the function becomes invalid.
Pointers to lua functions are possible, but can't be persistent (stored in global).
Pointers to lua functions are possible, but can't be persistent (stored in global).
- AlexPhoenix
- Fast Inserter
- Posts: 149
- Joined: Tue Feb 18, 2014 7:48 am
- Contact:
Re: [0.9.3] CTD caused by bug in modscript
kovarex, so none of the actions from Lua must not crash the game?
Re: [0.9.3] CTD caused by bug in modscript
We would like it to work that way yesAlexPhoenix wrote:kovarex, so none of the actions from Lua must not crash the game?
Re: [0.9.3] CTD caused by bug in modscript
Ok, so we decided that we will not fix it now, as it is quite complicated issue to fix, with possible overhead, so we will put this to known issue and get back to it when people using custom scripts to crash other in multiplayer starts to be issue
Until then, avoid using pointers to functions of Lua objects.
Until then, avoid using pointers to functions of Lua objects.