--[[
---------------------------------------------------------------------------
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
title = "Table Constructor Test"
require("defines");
require("functions");

squares = {1,4,9,16,25,36,49,64,81}

AIU = {}
AIU[1] = {"Name", 1, 2, 3}
AIU[2] = {"Name1", 10, 20, 30}
AIU[2] = {"Name2", 10, 20, 30}
AIU[2] = {"Name3", 10, 20, 30}
AIU[2] = {"Name4", 10, 20, 30}

--[[---------------------------------------------------------------------------------------]]
function setup(Engine, TIU)
	-- this function is called once when the [Run Script] button is pushed
	-- Engine : Engine number selected on the RTC Main window
	-- TIU : TIU number selected on the RTC Main window
	print("setup()");
	
	print(squares[2] .. " == 4");	-- 4
	
	Item = AIU[2];
	print(Item[2] .. " == 10");	-- 10
	
	print(AIU[2][1] .. " == Name1");
	AIU[2][1] = "New Name";
	print(AIU[2][1] .. " == New Name");
	
	print(string.format("RunTime = %.2f seconds", RunTime()));
	return Stop("End of Table Constructor Test");				-- end of Table Constructor Test
	end
--[[---------------------------------------------------------------------------------------]]	
function loop(Engine, TIU)
	print("loop()");

	Sleep(1);
	print("loop exit");	
	return true;		-- false=loop failed, true=loop succeeded
	end
--[[---------------------------------------------------------------------------------------]]
function cleanup(Engine, TIU)
	-- this function is called once when the user presses the [STOP] button
	print(string.format("cleanup() Complete at %.2f", RunTime()));
	return true;		-- false=cleanup failed, true=cleanup succeeded
	end
--[[---------------------------------------------------------------------------------------]]