Почему вызов MacroRunner.stop() не приводит к выходу из цикла?
local MacroRunner = { isRunning = false }
local recoilPattern = {}
recoilPattern[0] = {
x = 0,
y = 0
}
function MacroRunner:run()
MacroRunner.isRunning = true;
recoilIndex = 0
OutputLogMessage("run")
while true do
--MoveMouseRelative(-3, 4)
Sleep(250)
OutputLogMessage(tostring(MacroRunner.isRunning))
if MacroRunner.isRunning ~= true then break end
recoilItem = recoilPattern[recoilIndex]
OutputLogMessage("x: %d, y: %d \n", recoilItem.x, recoilItem.y)
--recoilIndex = recoilIndex + 1
end
end
function MacroRunner:stop()
OutputLogMessage("stop")
MacroRunner.isRunning = false;
end
function OnEvent(event, arg)
EnablePrimaryMouseButtonEvents(true);
--OutputLogMessage(event)
if IsMouseButtonPressed(1) ~= true then MacroRunner.stop() return end
--if IsMouseButtonPressed(1) and MacroRunner.isRunning ~= true then MacroRunner.run() end
--else MacroRunner.stop() end
end