-
Notifications
You must be signed in to change notification settings - Fork 0
/
startup.lua
30 lines (23 loc) · 930 Bytes
/
startup.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
if not turtle then return end -- Only run on turtles.
-- Set the working directory, so require works properly.
-- We use this in case we get set to `disk5` or something silly like that.
shell.setDir(fs.getDir(shell.getRunningProgram()))
-- Set the package path to include the lib directory.
package.path = package.path .. ";lib/?.lua;lib/?/init.lua"
local logging = require "logging"
-- Optional: Set logging level:
-- logging.set_level(logging.LOG_LEVEL.DEBUG)
-- Import the turtle client.
local turmitor_client = require "turmitor_client"
-- Optional: Set whether or not the Turmitor clients are built horizontally
-- or vertically. By default, this value is "vertical".
-- turmitor_client.array_style = "horizontal"
-- Run the Turmitor client.
local ok, err = pcall(
turmitor_client.run
)
-- Catch errors and log them.
if not ok then
logging.create_context("startup.lua").error(err)
logging.dump_log("log.txt")
end