[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Noob question -- On error, exit function and terminate script
- From: Xavier Wang <weasley.wx@...>
- Date: Sat, 25 Jun 2011 23:17:29 +0800
2011/6/25 Rebel Neurofog <firstname.lastname@example.org>
assert () is the best in your case (more verbose)
error () may also be helpful
especially if your error message requires complex evaluation:
-- This requires 'some_complex_call ()' even if there was no error:
assert (bar ~= "", "Error: "..some_complex_call ())
-- While this will call 'some_complex_call ()' only in case of error
if bar == "" then
error ("Error: "..some_complex_call ())
do we have simple ASSERT like thing to do this automatic?
just like macro or other thing...