lua-users home
lua-l archive

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


Graham Wakefield <lists@grahamwakefield.net> writes:
> Except that I can't figure out how to make a copy of a function in  Lua
> (or in the Lua API).  I guess I need to create a new closure,  which I
> can do with a cfuntion, but I can't see how to do it with a  lua
> function.

   function copy_fun (fun)
     return function(...) return fun(...) end
   end

?

[The extra level of indirection is ever so slightly annoying, but ...]

-miles
-- 
"Whatever you do will be insignificant, but it is very important that
 you do it."  Mahatma Gandhi