lua-users home
lua-l archive

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

On 29.10.2014 13:32, Roberto Ierusalimschy wrote:
>>> Tricky to do when there's format specifiers in general.
>> We probably need a way to specify the order in format specifiers
>> (like in GLIBC) first ...
> We probably need more than that. Many error messages in Lua are built
> piece by piece, not in a single format string. For instance, consider
> this message:

I think (read: am afraid) that many tools depend on exact error message
format. OTOH, if I used lua, I would want to be able to parse error
messages independent on user locale, i.e. don't want user's locale
setting to mess with error messages of the interpreter.

The solution(?) would be to use "error objects" - each error message
(object/structure) would have its unique errorId, and optional
parameters. Then render those messages at the highest possible level,
possibly using default lua renderer and a map of errorId to
errorMessages. But it seems like a lot of work.

>   > a = a + 1
>   stdin:1: attempt to perform arithmetic on a table value (global 'a')
> Thre is "attempt to %s a %s value%s", then an optional " (%s '%s')",
> filled with "perform arithmetic on", "table", "global", and 'a'. (BTW,
> "table" here is the type buildin name; should it be translated too?)

IMO no, because then you would need to translate some/all lua commands
and/or parameters (type({})=="table").