It happens! Glad to see people involved in JS at any level.

Chris

On Tuesday, June 9, 2015, Aaron Reabow <rea...@gmail.com> wrote:

> Right.  So I forgot about non blocking.  The call to redis will enough
> time for js to move on and execute down the page.
>
> I had the feeling this was going to be embarrassing :)
>
> On Monday, 8 June 2015 19:11:10 UTC+2, Aaron Reabow wrote:
>>
>> I have the feeling this might be really dumb.  I am trying to obtain the
>> value of a list's length from redis.
>>
>> It is returning correctly inside the anonymous function (if I console.log
>> it), I just can't for the life of me seem to access outside of that
>> function.
>>
>> Here I have set a local variable - len - and tried to assign a value for
>> it inside the function.
>>
>> I wouldn't expect it to work like this, because I should set a global
>> variable len instead.
>>
>> The strange thing is that neither approach works.  Even if the global
>> variable did the trick, it seems remiss to be using a global variable for
>> something so trivial.
>>
>> Any ideas on a solution?  Here is my code:
>>
>> var len = 0
>> redis.llen("chatRecord", function (err, length) {
>>             log('length from llen is: ' + length)
>> len = length
>>         });
>>
>  --
> Job board: http://jobs.nodejs.org/
> New group rules:
> https://gist.github.com/othiym23/9886289#file-moderation-policy-md
> Old group rules:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "nodejs" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/nodejs/nqYMwlBXzcU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> nodejs+unsubscr...@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','nodejs%2bunsubscr...@googlegroups.com');>.
> To post to this group, send email to nodejs@googlegroups.com
> <javascript:_e(%7B%7D,'cvml','nodejs@googlegroups.com');>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nodejs/cba44014-a14a-45e2-88dc-cf1d422ddfa3%40googlegroups.com
> <https://groups.google.com/d/msgid/nodejs/cba44014-a14a-45e2-88dc-cf1d422ddfa3%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Christopher Mina

Live Healthy. Work Hard. Be Kind. Gain Success.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
To post to this group, send email to nodejs@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAHp1eaMvocyZbUCiASN_NB8YaA1nZSmjKsJquc%3Dpjx3gu32DJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to