/**
* Loads a table either from our cached list, or inserts it into
* the database and adds it to our cached list
* @param options the table options
* @param callback callback(table or null)
*/
function loadTable(options, callback) {
var key = options.key + "." + options.tablename;
var priv = false;
if(options.tableid) {
key = options.key + "." + options.tableid;
priv = true;
}
if(tablelist[key]) {
callback(tablelist[key]);
return;
}
// insert or get existing
...