Software /
code /
prosody
Diff
util/stanza.lua @ 1932:af8cdbb63b13
util.stanza: Soften dependency on util.termcolours
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Tue, 06 Oct 2009 19:17:28 +0100 |
parent | 1931:f203330eb82e |
child | 1935:05adeddf9f1b |
line wrap: on
line diff
--- a/util/stanza.lua Tue Oct 06 18:05:31 2009 +0100 +++ b/util/stanza.lua Tue Oct 06 19:17:28 2009 +0100 @@ -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 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");