100 C H A P T E R 5 Scriptinghello =function() print('hello') endThe function can later be invoked viahello()5.4.10 Error handlingAnother big advantage of Lua over uBasic is the ability to run pieces of codein protected mode. This means that an error condition detected inside thiscode is not propagated to the surrounding code. Your script can gracefullyhandle this error and continue to run. The built-in function pcall() canexecute other functions in protected mode. For example:status,result = pcall(stopwatch,k)As you can see, pcall() can return multiple values:f If no error occurred, the first return value (status) has the value true,followed by the return values (if any) of the called function. In the aboveexample, result would contain the result of function stopwatch().f If an error occurred, the first returned value is false, followed by theerror message in the second return value.In addition to the errors raised by Lua itself, errors can also raised by a scriptthrough the error() function. The first parameter of this function is anerror message. The optional second parameter may contain an error levelthat indicates which additional information the Lua interpreter will add tothe error message:f 0: no additional information.f 1 (default): the location where the error() function was called.f n: the error location n levels up in the caller hierarchy.Lua also knows an assert instruction, which is usually used to test theconditions under which a piece of code is allowed to run.assert(cond, msg)If the expression cond results in false, an error is raised with the content ofthe parameter msg as an error message. The code following the assert