[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Seemingly inconsistency between function in a local variable and local function
- From: steve donovan <steve.j.donovan@...>
- Date: Mon, 2 Apr 2012 14:34:26 +0200
On Mon, Apr 2, 2012 at 2:22 PM, Robert Klemme
<shortcutter@googlemail.com> wrote:
> Why is that? What did I overlook?
Well,
function f(x) .. end
is equivalent to
f = function(x) .. end
and
local function g(x) .. end
is equivalent to
local g
g = function(x) ... end
After making these substitutions, the rest should make sense; for
instance, this doesn't work
local g
local function g() .. end
because it actually means
local g
local g
g = function() .. end
and so you're overwritten that local variable.
steve d.