lua-users home
lua-l archive

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


On Tue, Jan 14, 2014 at 2:41 PM,  <colinz@gmx.com> wrote:
> By the way, is it possible to define some aliases for operators or other
> syntactic elements? As in the case of .. for concatenation, would it be
> possible for a programmer to 'rename' it (without changing the source, of
> course)?

Lua is flexible in that way.  Operations on strings are 'metamethods'
and they can be overrided:

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> smt = debug.getmetatable("")
> smt.__add = function(x,y) return x..y end
> = "one" + "two"
onetwo
>

As for 'all in one' I do think that the Love2D distribution works like that...

steve d.