[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: AW: finalisation if error occur
- From: "Zimmermann Maik" <zimmermann@...>
- Date: Mon, 12 Jul 2004 16:43:48 +0200
Hi Markus,
wrap your call to Script witch the pcall or xpcall functions
from the base library. A look at chapters 8.4 and 8.5 of
Programming in Lua might also be usefull.
Maik
> With this example the finalisation runs perfect as long as no error
> occured. <file> is the main programm and if Script() ends then the
> function Finalise() is called. But how can I fetch errors so that:
>
> 1. the original error is documentated in the error logs
> as good as standard behaviour (traceback)
> 2. Finalise() is called
> domcument errors now like Lua original
> 3. end
>
>
> function Finalise()
> -- do something
> end
>
>
> do
>
> local Script,Error=loadfile(<file>)
>
> if Script then
> Script()
> Finalise()
> else
> io.write(Error)
> end
>
> end
>
>
>
>
> --
> Markus
>
>
____________
Virus checked by G DATA AntiVirusKit
Version: AVK 14.0.1390 from 12.07.2004
Virus news: www.antiviruslab.com
____________
Virus checked by G DATA AntiVirusKit
Version: AVK 14.0.1390 from 12.07.2004
Virus news: www.antiviruslab.com