Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local warehouseID = "templol"
- function stringSplit (inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- function setup()
- local warehouseData = { }
- term.clear()
- term.setCursorPos(1, 1)
- print("How many rows are there?> ")
- term.setCursorPos(27, 1)
- rowNum = read()
- term.setCursorPos(1, 2)
- print("How long are the rows?> ")
- term.setCursorPos(25, 2)
- rowLen = read()
- term.setCursorPos(1, 3)
- print("How high are the rows?> ")
- term.setCursorPos(25, 3)
- rowHeight = read()
- term.setCursorPos(1, 4)
- print("coords just inside the left, front-most aisle")
- term.setCursorPos(1, 5)
- index = read()
- for i = 1, rowNum, 1 do
- rowID = "row".. i
- warehouseData[rowID] = {}
- for i = 1, rowLen, 1 do
- columnID = "column" .. i
- warehouseData[rowID][columnID] = {}
- for i = 1, rowHeight, 1 do
- chestID = "chest"..i
- warehouseData[rowID][columnID][chestID] = {"this is a long table"}
- end
- end
- end
- warehouseDataSplit = stringSplit(textutils.serialize(warehouseData), "\n")
- fs.delete(warehouseID .. "Data")
- warehouseDataFile = fs.open(warehouseID .. "Data", "a")
- for lineNum, line in pairs(warehouseDataSplit) do
- warehouseDataFile.writeLine(line)
- print(line)
- end
- end
- if(fs.exists(warehouseID .. "Data"))then
- terminal()
- else
- setup()
- end
Add Comment
Please, Sign In to add comment