lua-users home
lua-l archive

finalisation if error occur

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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

AltStyle によって変換されたページ (->オリジナル) /