--[[
---------------------------------------------------------------------------
Remote Train Control Program for Windows

© Copyright 2019 by Mark DiVecchio

	This file is part of Remote Train Control.

	Remote Train Control is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	Remote Train Control is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

 Home Page : http://www.silogic.com/trains/RTC_Running.html
---------------------------------------------------------------------------]]
-- Semicolons are not required in Lua code
-- EmergenyStop() Test
title = "Divide by Zero Test"
require("defines");
--[[---------------------------------------------------------------------------------------]]
function setup(Engine, TIU)
	print("setup() run");
	return true;
	end
--[[---------------------------------------------------------------------------------------]]	
function loop(Engine, TIU)
	-- Always call Sleep() at least once in this function.
	print("loop() started with Sleep(5) call");
	Sleep(2);
	print("Returned from Sleep(5) call");
	print("Dividing by Zero");
	Sleep(1);
	local op1 = 0;
	local op2 = 100;
	local op3 = op2 / op1;	-- should display messages as shown below.
	print("This message should not display");
	--
	-- Should display this messages:
	-- Emergency Stop: Cycle Power on the WTIU/TIU and then restart RTC
	-- "Your script did something that I didn't understand. Sorry, I can't help you figure it out."
	--
	return false;
	end
--[[---------------------------------------------------------------------------------------]]	
function cleanup(Engine, TIU)
	print("cleanup() This message should not display");
	EngineShutdown(Engine, TIU);
	return true;
	end
--[[---------------------------------------------------------------------------------------]]