aboutsummaryrefslogtreecommitdiffstats
path: root/util/stanza.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-10-06 19:17:28 +0100
committerMatthew Wild <mwild1@gmail.com>2009-10-06 19:17:28 +0100
commit2f726a9d3b201adf0ba97baa748cd9abd53e078e (patch)
treebc32a98ac0e8a0c482bd3787ec5a5aa7c4ef1de6 /util/stanza.lua
parent7b3fe9ce142053c2159fb1479343d7815bbb4f2f (diff)
downloadprosody-2f726a9d3b201adf0ba97baa748cd9abd53e078e.tar.gz
prosody-2f726a9d3b201adf0ba97baa748cd9abd53e078e.zip
util.stanza: Soften dependency on util.termcolours
Diffstat (limited to 'util/stanza.lua')
-rw-r--r--util/stanza.lua11
1 files 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");