From 2f726a9d3b201adf0ba97baa748cd9abd53e078e Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 6 Oct 2009 19:17:28 +0100 Subject: util.stanza: Soften dependency on util.termcolours --- util/stanza.lua | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/util/stanza.lua b/util/stanza.lua index 7b04c508..ba864e01 100644 --- a/util/stanza.lua +++ b/util/stanza.lua @@ -6,7 +6,6 @@ -- COPYING file in the source package for more information. -- - local t_insert = table.insert; local t_concat = table.concat; local t_remove = table.remove; @@ -28,7 +27,15 @@ local s_find = string.find; local os = os; local do_pretty_printing = not os.getenv("WINDIR"); -local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring; +local getstyle, getstring; +if do_pretty_printing then + local ok, termcolours = pcall(require, "util.termcolours"); + if ok then + getstyle, getstring = termcolours.getstyle, termcolours.getstring; + else + do_pretty_printing = nil; + end +end local log = require "util.logger".init("stanza"); -- cgit v1.2.3