lua-users home
lua-l archive

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


Javier Guerra wrote:
> On 12/13/07, Rici Lake <lua@ricilake.net> wrote:
>
>> I don't see the advantage of using globals, though. Stashing the
>> localizations in a table called L (with a __call metamethod) does not
>> use more space, and avoids namespace pollution.
>>
>
> why the __call ?    i find
>
> print(L.DidNotWork)
>
> far more readable and less error-prone than
>
> print(L"Operation did not succeed")

Because tastes differ :)

The advantage of L"Operation did not succeed" is that it provides a
built-in default, which avoids the problem of incomplete translation
files. On the other hand, it makes translation files somewhat more error
prone.

That's an old argument, as can be seen from the difference between
localization libraries (compare GNU gettext with token-based localization
systems) and I wouldn't really want to get into it: the point is that Lua
can easily support both styles.

R.