diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-10-06 19:17:28 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-10-06 19:17:28 +0100 |
commit | 2f726a9d3b201adf0ba97baa748cd9abd53e078e (patch) | |
tree | bc32a98ac0e8a0c482bd3787ec5a5aa7c4ef1de6 /util/stanza.lua | |
parent | 7b3fe9ce142053c2159fb1479343d7815bbb4f2f (diff) | |
download | prosody-2f726a9d3b201adf0ba97baa748cd9abd53e078e.tar.gz prosody-2f726a9d3b201adf0ba97baa748cd9abd53e078e.zip |
util.stanza: Soften dependency on util.termcolours
Diffstat (limited to 'util/stanza.lua')
-rw-r--r-- | util/stanza.lua | 11 |
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"); |