Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Oct 5th, 2012  |  syntax: JavaScript  |  size: 0.55 KB  |  views: 87  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /**
  2.  * Loads a table either from our cached list, or inserts it into
  3.  * the database and adds it to our cached list
  4.  * @param options   the table options
  5.  * @param callback  callback(table or null)
  6.  */
  7. function loadTable(options, callback) {
  8.  
  9.     var key = options.key + "." + options.tablename;
  10.     var priv = false;
  11.  
  12.     if(options.tableid) {
  13.         key = options.key + "." + options.tableid;
  14.         priv = true;
  15.     }
  16.  
  17.     if(tablelist[key]) {
  18.         callback(tablelist[key]);
  19.         return;
  20.     }
  21.  
  22.     // insert or get existing
  23.     ...