lua-users home
lua-l archive

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


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.