[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [proposal] A statement that can return value (and can used in expr)
- From: David Manura <dm.lua@...>
- Date: Tue, 13 Dec 2011 23:03:12 -0500
On Tue, Dec 13, 2011 at 3:39 PM, Xavier Wang <firstname.lastname@example.org> wrote:
> local c = 10
> local function f(a, b) print "a statement" return a + b + c end
In 5.2, you'll need to translate that code to pass c as a parameter to
f if you want it to reuse the closure. Lua 5.2 presently does not
take full advantage of all optimizations available on this. I made
some comments on that on the bottom of .
> local a = (function(a, b) return a + b end)(10, 20) + 30
> local a, b = 10, 20
> local ret = a + b
> local a = `ret` + 30
That's similar to what  does in Metalua.