Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add link to ruleset

...

We'll now show the KRL code to put together this array, taking a top-down approach. The complete ruleset is on GitHub.

Code Block
linenumberstrue
ruleset net.sanbachs.counters {
  meta {
    shares __testing, number
  }
  global {
...
    // /sky/cloud/<ECI>/<RID>/number.gif?n=999&color=[R,G,B]&bgcolor=[R,G,B]
    number = function(n,color,bgcolor) {
      num = n.as("String").extract(re#(\d)#g).join("");
      num_len = num.length() <= 25 => num.length() | 25;
      h(num_len,val(color),val(bgcolor))
        .append(num.substr(0,num_len).split(re##).map(dgt).reduce(flt,[]))
        .append(T)
    }
  }
}

...