util/stanza.lua
changeset 1932 af8cdbb63b13
parent 1931 f203330eb82e
child 1935 05adeddf9f1b
equal deleted inserted replaced
1931:f203330eb82e 1932:af8cdbb63b13
     3 -- Copyright (C) 2008-2009 Waqas Hussain
     3 -- Copyright (C) 2008-2009 Waqas Hussain
     4 -- 
     4 -- 
     5 -- This project is MIT/X11 licensed. Please see the
     5 -- This project is MIT/X11 licensed. Please see the
     6 -- COPYING file in the source package for more information.
     6 -- COPYING file in the source package for more information.
     7 --
     7 --
     8 
       
     9 
     8 
    10 local t_insert      =  table.insert;
     9 local t_insert      =  table.insert;
    11 local t_concat      =  table.concat;
    10 local t_concat      =  table.concat;
    12 local t_remove      =  table.remove;
    11 local t_remove      =  table.remove;
    13 local t_concat      =  table.concat;
    12 local t_concat      =  table.concat;
    26 local s_char        =   string.char;
    25 local s_char        =   string.char;
    27 local s_find        =   string.find;
    26 local s_find        =   string.find;
    28 local os            =            os;
    27 local os            =            os;
    29 
    28 
    30 local do_pretty_printing = not os.getenv("WINDIR");
    29 local do_pretty_printing = not os.getenv("WINDIR");
    31 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
    30 local getstyle, getstring;
       
    31 if do_pretty_printing then
       
    32 	local ok, termcolours = pcall(require, "util.termcolours");
       
    33 	if ok then
       
    34 		getstyle, getstring = termcolours.getstyle, termcolours.getstring;
       
    35 	else
       
    36 		do_pretty_printing = nil;
       
    37 	end
       
    38 end
    32 
    39 
    33 local log = require "util.logger".init("stanza");
    40 local log = require "util.logger".init("stanza");
    34 
    41 
    35 module "stanza"
    42 module "stanza"
    36 
    43