[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Passing expression as a parameter
- From: Dirk Laurie <dirk.laurie@...>
- Date: Wed, 9 Jan 2013 19:31:13 +0200
2013/1/9 Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br>:
>> lambda = function(def)
>> local arrow = "->"
>> local args,result = def:match("(.*)"..arrow.."(.*)")
>> return load(args.."=... return "..result)
>> end
>
> Don't you have to escape '-' in arrow?
>
> (Forgetting to escape '-' in Lua patterns is a common mistakel one that
> I've made several times...)
>
Oops, I tested the code with Unicode `→` and changed it in
the e-mail in case people can't read Unicode, sorry!