Re: Re: Untitled

By Diminutive Parakeet, 11 Years ago, written in TCL/iTCL, viewed 420 times. This paste is a reply to Re: Untitled by Tinct Marten
URL http://pb.stoleyour.com/view/75c74f19 Embed
Download Paste or View RawExpand paste to full width of browser
  1. package require http
  2. package require json
  3.  
  4. bind pub - !gw2 pub:gw2Stats
  5.  
  6. proc pub:gw2Stats { nick uhost handle channel arg } {
  7.         set urlMatch "http://gw2stats.net/api/matches.json"
  8.         set urlRank "http://gw2stats.net/api/ratings.json"
  9.         set jsonMatch [http::data [http::geturl $urlMatch]]
  10.         set jsonRank [http::data [http::geturl $urlRank]]
  11.         set apiMatch [json::json2dict $jsonMatch]
  12.         set apiRank [json::json2dict $jsonRank]
  13.        
  14. namespace eval gw2Utils {
  15.  
  16.         set tsvPath "tsvgw2/"
  17.        
  18.         proc parsePairs { tsvName } {
  19.                 set f [open [file nativename $gw2Utils::tsvPath$tsvName] r]
  20.                 while { [eof $f] == 0 } {
  21.                         set splitLine [split [gets $f] "\t"]
  22.                         set pairMap([lindex $splitLine 0]) [lindex $splitLine 1]
  23.                 }
  24.                 return [array get pairMap]
  25.         }
  26.        
  27.         proc insertCommas { num {sep ,} } {
  28.                 while { [regsub {^([-+]?\d+)(\d\d\d)} $num "\\1$sep\\2" num] } {}
  29.                 return $num
  30.         }
  31.        
  32.        

Replies to Re: Re: Untitled rss

Title Name When
Re: Re: Re: Untitled Mungo Macaw 11 Years ago.

Reply to "Re: Re: Untitled"

Here you can reply to the paste above