Lee Yi
Lee Yi

Reputation: 527

Lua exiting immediately after throwing an error

I'm using the Lua 5.2.3 Binary for windows, and I'm trying to run a code. I know the code is throwing an error, but the interpreter closes immediately, so I can't find out what it is.

Is there a way to stop it from closing immediately?

Edit: All my lua scripts pretty much exit immediately after the program ends. Is there a way to stop this too?

Upvotes: 0

Views: 972

Answers (1)

A.G.
A.G.

Reputation: 1319

In Lua scripts, you can catch exceptions and handle them using the function pcall(). You should have a look at 8 – Compilation, Execution, and Errors and espacially 8.4 – Error Handling and Exceptions.

Upvotes: 1

Related Questions