lua-users home
lua-l archive

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


On 15 January 2014 00:41,  <colinz@gmx.com> wrote:
> On 2014-01-14 14:33, steve donovan wrote:
>>
>> On Tue, Jan 14, 2014 at 3:24 PM, Luiz Henrique de Figueiredo
>> <lhf@tecgraf.puc-rio.br> wrote:
>>>
>>> But try print(type("1"+"2"))
>>
>>
>> Exactly why I wouldn't do it ;)  It is a good idea to have separate
>> operators, otherwise there is all that pain that JavaScript users have
>> when they're not careful.
>
>
> So, by maintaining the two operators separate, which is fine, could I
> redefine .. to something like 'concat'?
> That way I would end up having "Hello" concat "World"
>
>

Not unless you use a modified version of Lua or a source-to-source
converter. Lua lets you overload the functionality of existing
operators, but you can't create your own aliases for them.