Log in

View Full Version : Module toggling



kamilqq
11-14-2015, 10:27 PM
Hello ive ask for more advanced users. How to start stop module from another one. Example one module can stop the second one. I tried with everything couldnt make it work. Maybe ive made silly mistake. Thanks ;)

shadowart
11-14-2015, 10:38 PM
Hello ive ask for more advanced users. How to start stop module from another one. Example one module can stop the second one. I tried with everything couldnt make it work. Maybe ive made silly mistake. Thanks ;)
Did you use Module: Delay inside the module you tried to stop? Module: Delay and Module:Stop used to interact badly which made it impossible to stop delayed modules from the outside. However, this got fixed a few days ago.

kamilqq
11-14-2015, 11:14 PM
Did you use Module: Delay inside the module you tried to stop? Module: Delay and Module:Stop used to interact badly which made it impossible to stop delayed modules from the outside. However, this got fixed a few days ago.

Thanks ill check this out soon. I had that prpblem like a month ago. Ill edit.
To be sure can u show me an example? When i made module.new('name', func()) and inside module used print modulename it printed 0. Im on phone sry.

shadowart
11-14-2015, 11:22 PM
Thanks ill check this out soon. I had that prpblem like a month ago. Ill edit.
To be sure can u show me an example? When i made module.new('name', func()) and inside module used print modulename it printed 0. Im on phone sry.
Something like this should work:

Module("Module One", function(this)
if math.random(1, 100) < 10 then
print("Stopping both modules!")
Module.Stop("Module Two")
this:Stop()
else
this:Delay(1000)
end
end)

Module("Module Two", function(this)
print("Module two is still running!")
this:Delay(1000)
end)

kamilqq
11-14-2015, 11:28 PM
Something like this should work:

Module("Module One", function(this)
if math.random(1, 100) < 10 then
print("Stopping both modules!")
Module.Stop("Module Two")
this:Stop()
else
this:Delay(1000)
end
end)

Module("Module Two", function(this)
print("Module two is still running!")
this:Delay(1000)
end)


made exacly same code and it didnt worked. the second was printing. So ill check this once more :) thanks.