lua-users home
lua-l archive

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

On Mon, Apr 2, 2012 at 2:22 PM, Robert Klemme
<> wrote:
> Why is that?  What did I overlook?


   function f(x) .. end

is equivalent to

   f = function(x) .. end


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.