hi,
I saw in the LuaCookbook that a component should cleanup its ports and properties by putting rttlib.tc_cleanup() in the cleanupHook of the component.
I was wondering of this was standard already there, or that you really have to put it there manually?
If you still have to put it there manually, can I do this from my deployer (lua style)?
I have namely this particular component that has actually no real file that describes it, it is created in the deployer and has just some ports that I added with addPort().
something like component:cleanup()=function () rttlib.tc_cleanup(); return true end
Nick
lua component cleanup
On Tue, Dec 11, 2012 at 06:59:56PM +0100, Dominick Vanthienen wrote:
> hi,
>
> I saw in the LuaCookbook that a component should cleanup its ports
> and properties by putting rttlib.tc_cleanup() in the cleanupHook of
> the component. I was wondering of this was standard already there,
> or that you really have to put it there manually? If you still have
> to put it there manually, can I do this from my deployer (lua
> style)?
If your RTT is new enough I would recommend to use tc_cleanup since it
will take care no Ports and Properties are forgotten to be cleanup
up. This is especially true if you reset your Lua component by going
through loops( configure->running->cleanup->configure...)
> I have namely this particular component that has actually no real
> file that describes it, it is created in the deployer and has just
> some ports that I added with addPort(). something like
> component:cleanup()=function () rttlib.tc_cleanup(); return true end
No, you can't do this. But setting a cleanupHook from the outside:
component:exec_str([[ function cleanup() rttlib.tc_cleanup(); return true; end ]] )
should have a similar effect.
Markus