lua-users home
lua-l archive

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


2011/12/17 Xavier Wang <weasley.wx@gmail.com>:
> hi robero and list,
>
> i'm inspired by the post about implement c enum. somebody said the getflags
> function shoud return a userdata to implement a contains function. i think
> its a good idea, excerpt a details: thus will allocate memory.
>
> i'm run lua on a embedded system, embedded systemembedded system, nokia n73
> cellphone. my game will lag if i allocate memory in draw function since the
> garbage collection. so we avoid any memory in event loop. but i really miss
> the contains function, so i think a syntax allow use function as infix
> operator will be great.
>
> e.g. if i have a function add(a, b), i can call it with a `add` b, its a
> syntax sugar of add(a,b)
>
> its very simple and can used in many situations, e.g. bitop calls, and flags
> contains test.
>
> has anybody agree me? i hope this feature can appear on lua5.3 :)
>
> thanks everybody~

That would be an interesting idea. Funny I was just thinking of infix
functions a few minutes ago too!

-- 
Sent from my toaster.