'datat' is scoped outside your function. twit.search is async and therefore may not return 'data' before you check 'datat' with sys.inspect.
This should let you see datat:
var datat;
twit.search('#louieck', {include_entities:true,page:paget,maxid:maxidt}, function(data) {
// and output to the console:
datat = data;
sys.puts(sys.inspect(datat));
});
But ideally you'd use a callback like this...
var datat;
var callback = function(d){
sys.puts(sys.inspect(d));
datat = d;
// do something more with datat
};
twit.search('#louieck', {include_entities:true,page:paget,maxid:maxidt}, function(data) {
callback(data);
});
EDIT - simplified as per comment...
var datat;
var callback = function(d){
sys.puts(sys.inspect(d));
datat = d;
// do something more with datat
};
twit.search('#louieck', {include_entities:true,page:paget,maxid:maxidt},callback(data));
sys.puts, the callback function hasn't been called yet sodatatis empty. Welcome to the world of asynchronicity :)