lua-users home
lua-l archive

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


>IMHO the API for dostring (and dofile and call) is broken.  The only
>thing guarantied is that in case of an error you get the two results
>nil and a string.  But whether this two values are in fact generated
>by the system to signal an error or are the actual return values of
>the executed code is not visible.

I have found it frustrating also that some io and socket functions have
nil returned on success, some nil on error, some return a message in the
first value and some in the second, not to mention that execute will do
"0" on success, etc.

I would prefer something like _ERRNO and _ERRMSG where after any call you
can check success/failure and get the error message string in a consistent
way, or else return success/failure ALWAYS as the first value with nil
ALWAYS being success.  Setting global _ERRNO and _ERRMSG codes on all
calls could be done without breaking backwards compatability, too.

-Tom