[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: What is the equivalent of die() command of perl
- From: steve donovan <steve.j.donovan@...>
- Date: Thu, 10 Sep 2009 14:09:55 +0200
On Thu, Sep 10, 2009 at 1:54 PM, Anurag Sharma
<anurag.sharma.101@gmail.com> wrote:
> Is there any equivalent in Lua.. If yes, what is it?
Lua also uses assert() a lot. For instance,
assert(Myfunction(),"we failed")
More interesting is this:
f = assert(io.open(file))
...
This actually gives a sensible error trace, because if io.open fails
it returns two values, nil and an error message. The second parameter
of assert() is the message string, so it works as expected.
steve d.