[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Chaning code at run time
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Thu, 7 Aug 2008 21:29:21 -0300
> I would like to be able to change the following lua function at run time:
>
> function new_foo()
> local foo_update = function()
> -- do something
> end
>
> return { foo_update = foo_update }
> end
>
> foo.foo_update() -- foo was created during initialization
>
> Is there any way to change foo_update during run time? If not, then is there another way to create objects which allows me to change them at run time?
Unless I'm missing something, you can just do
foo.foo_update = function () <do something else here> end