Reputation: 1011
I have a config file from a previous version of my software, the config file is basically a Lua script. I'm using swig to generate the wrapper to interface with the C API of my software.
The problem that I'm having is that some instructions in the previous config file was removed in the current version of the software.
When I load and run the Lua file the execution stop at the first error and the rest of the config file is not executed.
How can I make Lua report an error and continue the script execution at the next instruction?
Upvotes: 1
Views: 1198
Reputation: 9549
You might want to take a look at the error handling section in the Lua Manual (look here for version5.1 ).
It all boils down to putting the "sensitive" code into a function and call it with pcall
.
More info on handling errors in Programming in Lua
Upvotes: 2