lua-users home
lua-l archive

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


> In Python you can pass the function object as a default parameter to
> work around this problem. However, I have no idea how to work around
> this in Lua. Upvalues don't work, because the variable is created
> after the function definition has been evaluated. Just for the fun of
> it, ideas anyone?

I thought about something like

  function f()
    function g()
      dostring("%g()")
    end
  end

but... You can't nest function declarations... Oh, well.

Oh, well.

> 
> - Christian


--

  Magnus Lie Hetland      (magnus at hetland dot org)

 "Reality is what refuses to disappear when you stop
  believing in it"                 -- Philip K. Dick