[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Idea: numbered error messages
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Sat, 5 Feb 2005 09:43:21 -0200
> one huge problem with string-based error messages is that
> they're not well-defined enough to use properly as exceptions.
Lua actually does not use strings -- it uses numeric codes LUA_ERR*,
which are returned by lua_pcall and friends. Strings are there as
But you're suggesting something else: that the programmer may raise
errors based on numeric codes. Lua actually already supports this: it
allows you to throw any value in a error: lua_error takes the value on
top of the stack and put it there when lua_pcall and friends return.