Lua code can explicitly generate an error by calling the function (see ). If you need to catch errors in Lua, you can use the pcall function (see 5.1).