> Just because they are mutually exclusive, doesn't mean you have to close the
> lua state. Is there something else going on to cause you to do that?
> Can't you leave
> them both in existence, and just run one, or the other?
Yes there is some other non related system stuff going on that made it easier to kill and create new tasks. I was aware that one possible solution is to retain the Lua state and skip the luaL_loadfile() call on 2nd and subsequent invocations. This would mean a little bit of a fiddly rewrite for other reasons, so I was wondering if there are any other sensible solutions to this problem where I could still kill and create the tasks as needed ?