Hi,
I am working on a mod that will provide a "scripted combinator".
That will allow for a player provided lua script to be excuted.
I use the lua xpcall() to prevent game crashes but some errors are still handled by the "game itself" (f.e. index out of bounds on signal parameters, nil value for entity elements).
Would like to catch all errors within the mod
option to catch all lua runtime errors
Re: option to catch all lua runtime errors
You may Look at this: https://mods.factorio.com/mod/LuaCombinator
Re: option to catch all lua runtime errors
Thanks for the pointer.
Checked the lua combinator mod but that will have the same problem.
It is using the pcall() to execute -> will also break
Checked the lua combinator mod but that will have the same problem.
It is using the pcall() to execute -> will also break
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: option to catch all lua runtime errors
Can you provide an example (preferably /c pastable) for such a command whichs errors "leak" out of pcalls? I have some player command handling too and would like to test.
Re: option to catch all lua runtime errors
Hi,
I was wrong.
Made the error myself. The code in the xpcall is correctly protected as far as I can see now.
The crash occured when I was processing the function result in the main mod code which is not xpcall protected.
For now this closes my question, sorry for that.
I was wrong.
Made the error myself. The code in the xpcall is correctly protected as far as I can see now.
The crash occured when I was processing the function result in the main mod code which is not xpcall protected.
For now this closes my question, sorry for that.