lua-users home
lua-l archive

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


Hi Chris


On Thu, Feb 16, 2006 at 04:35:08PM -0500, Chris wrote:
>    The problem with string error messages can be pointed at in your own
>    example: 
> 
>         elseif problem == "radiu failure"
how is this different from any typo in a number?
In that you can tell the error in the string, no?

>    Numeric error codes (or other "fixed" types like an exception) are much
>    more useful for error handling in code.  The strings are good for the end
>    user for sure but code needs a little more.
which is what exactly?

>    This is especially true when dealing with multiple languages like I am.  I
>    have a Lua backend interfacing to C, XML-RPC, and JavaScript.  The text
>    messages are just not reliable enough with all these systems in play
>    (versus numeric codes which would be easy to deal with in all those
>    systems).
obviously you either depend on some constants of whatever type,
which is reliable, or you don't.
How is it easier to use numeric constants cross language than strings?

I see it is nice to use a switch or some bitmasking on numbers in C,
but in Lua, extracting some substring is better supported than bit ops.


cheers
Klaus