-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
slackr-not-working-from-within-function #18
Comments
Newest build (1.3.0.9000) should fix this but needs extensive testing.
|
I put the original post up on Stack Overflow and agree that it has fixed the example I provided. I'll be using slackr() in functions quite a bit in the next few weeks and if I encounter and issues I'll update here. Thanks for the quick turnaround. Much appreciated! |
cool. thx. |
Here's an issue I just encountered with the new build...
|
http://stackoverflow.com/questions/31703569/slackr-not-working-from-within-function?noredirect=1
I am using the slackr package to post messages to Slack. I have the following code that works when outside a function (i.e. posts two messages, twice, to Slack), but when used within a function, uses the variable values from outside the function, not as set within the function.
An example will help illustrate.
From the above snippet, I would expect two messages from the loop outside of the function, then two messages from the call to slackr() after the loop. The min:seconds in the output would be 12:45, 12:46 then 12:45, 12:46 again.
From the call to the function, I would again expect two messages from the loop within the function, then the same two messages from the call to slackr() after the loop. The min:seconds should be 13:04, 13:04 then 13:04, 13:04.
The attached image is the output I actually get in Slack. The loop works as expected, but the call to slackr() from the function for some reason uses the variable values as they were before the function was called (i.e. msg and aMsg are not changed by the function at all). However, slackr does post the string 'Now post to Slack from function' up to Slack from the function.
Anyone have any idea what is going on here? Something to do with global environments? Very odd!
The text was updated successfully, but these errors were encountered: