shadowart
03-18-2015, 08:23 PM
Bug ReportOperating System:
Windows 7 x64 Short Description:
Module:Stop Behaviors: Feature error
Indepth Description:
Module:Stop from the xenobot library is currently bugged which makes it impossible to stop any module that includes a call to Module: Delay.
function Module:Stop()
self = type(self)=='table' and self or Module.New(self)
self._active = false
end
function Module:Delay(delayTime)
self = type(self)=='table' and self or Module.New(self)
self._tempDelay = (os.clock() * 1000) + delayTime
self._active = false
end
function libOnTimer()
if(#libModules > 0)then
for i, m in ipairs(libModules) do
if(m._tempDelay < (os.clock()*1000) and m._tempDelay > 0 and not m._active)then
m.delayTime = 0
m._active = true
end
if(m._active)then
m:Execute()
end
end
end
end
As can be seen above the scheduler will restart a stopped module if its tempDelay has been set by a previous call to Module: Delay.
One solution would be to make Module:Stop set the tempDelay attribute to a non-positive value, like this:
function Module:Stop()
self = type(self)=='table' and self or Module.New(self)
self._active = false
self._tempDelay = -1
end
Windows 7 x64 Short Description:
Module:Stop Behaviors: Feature error
Indepth Description:
Module:Stop from the xenobot library is currently bugged which makes it impossible to stop any module that includes a call to Module: Delay.
function Module:Stop()
self = type(self)=='table' and self or Module.New(self)
self._active = false
end
function Module:Delay(delayTime)
self = type(self)=='table' and self or Module.New(self)
self._tempDelay = (os.clock() * 1000) + delayTime
self._active = false
end
function libOnTimer()
if(#libModules > 0)then
for i, m in ipairs(libModules) do
if(m._tempDelay < (os.clock()*1000) and m._tempDelay > 0 and not m._active)then
m.delayTime = 0
m._active = true
end
if(m._active)then
m:Execute()
end
end
end
end
As can be seen above the scheduler will restart a stopped module if its tempDelay has been set by a previous call to Module: Delay.
One solution would be to make Module:Stop set the tempDelay attribute to a non-positive value, like this:
function Module:Stop()
self = type(self)=='table' and self or Module.New(self)
self._active = false
self._tempDelay = -1
end