From f5dede540eb71f2b10d36f478e630ac15eef0e76 Mon Sep 17 00:00:00 2001 From: kepler155c Date: Wed, 11 Oct 2017 15:07:32 -0400 Subject: [PATCH] cleanup --- apps/music.lua | 8 ++++---- apps/mwm.lua | 3 ++- apps/recorder.lua | 10 ++++++++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/music.lua b/apps/music.lua index 33a7eba..32a058b 100644 --- a/apps/music.lua +++ b/apps/music.lua @@ -11,15 +11,15 @@ local multishell = _ENV.multishell multishell.setTitle(multishell.getCurrent(), 'Music') +if not turtle then + error('This program can only be run on a turtle') +end + local radio = device.drive or error('No drive attached') if radio.side ~= 'top' and radio.side ~= 'bottom' then error('Disk drive must be above or below turtle') end -if not turtle then - error('This program can only be run on a turtle') -end - UI:configure('Music', ...) UI.Button.defaults.backgroundFocusColor = colors.gray diff --git a/apps/mwm.lua b/apps/mwm.lua index 2346ab5..7682781 100644 --- a/apps/mwm.lua +++ b/apps/mwm.lua @@ -1,4 +1,4 @@ -local injector = requireInjector or load(http.get('https://raw.githubusercontent.com/kepler155c/opus/master/sys/apis/injector.lua').readAll())() +local injector = _G.requireInjector or load(http.get('https://raw.githubusercontent.com/kepler155c/opus/develop/sys/apis/injector.lua').readAll())() injector() local Canvas = require('ui.canvas') @@ -7,6 +7,7 @@ local Util = require('util') local colors = _G.colors local os = _G.os local peripheral = _G.peripheral +local printError = _G.printError local shell = _ENV.shell local term = _G.term local window = _G.window diff --git a/apps/recorder.lua b/apps/recorder.lua index d925302..47a8f63 100644 --- a/apps/recorder.lua +++ b/apps/recorder.lua @@ -83,7 +83,10 @@ local function loadAPI(url, env) apiEnv.shell = nil apiEnv.multishell = nil setmetatable(apiEnv, { __index = _G }) - local fn = Util.loadUrl(url, apiEnv) + local fn, m = Util.loadUrl(url, apiEnv) + if not fn then + error(m) + end fn() return apiEnv end @@ -91,7 +94,10 @@ end bbpack = loadAPI('http://pastebin.com/raw/PdrJjb5S', getfenv(1)) GIF = loadAPI('http://pastebin.com/raw/5uk9uRjC', getfenv(1)) -Util.runUrl(getfenv(1), 'http://pastebin.com/raw/cUYTGbpb', 'get', 'CnLzL5fg') +local s, m = Util.runUrl(getfenv(1), 'http://pastebin.com/raw/cUYTGbpb', 'get', 'CnLzL5fg') +if not s then + error(m) +end -- 'Y0eLUPtr') -- CnLzL5fg local function snooze()