Skip to content
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

command.scout.ack assumes the first arg is a plain command name #195

Open
alexglow opened this issue Oct 13, 2014 · 1 comment
Open

command.scout.ack assumes the first arg is a plain command name #195

alexglow opened this issue Oct 13, 2014 · 1 comment
Assignees
Labels

Comments

@alexglow
Copy link
Contributor

Entered in Arduino IDE:
command.scout.ack("led.green(500)", 11, "led.green", 500);

It works as expected (both Scouts' LEDs flash green, 500ms). However, it returns an error:
missing )

According to Jeremie:
It is trying to run led.green(500)(1,rssi)
Just assumes the first arg is a plain command name, it can detect a ( and skip that

(Which is why, if you store led.green(500) as a command and substitute that into command.scout.ack, you don't get an error.)

Cheers!

@matthijskooijman
Copy link
Collaborator

According to Jeremie:
It is trying to run led.green(500)(1,rssi)
This is also what the docs say:

| a local callback ScoutScript command, callback is evaluated if it is
| defined. The callback command will be passed two arguments, err and
| rssi.

Perhaps this could be clarified by saying "a local callback ScoutScript
function" instead, though.

Just assumes the first arg is a plain command name, it can detect a ( and skip that
If Jeremie is saying to ignore the part after the () - then I'd be
opposed - things will break in hard-to-debug ways if the argument list
is silently discarded and replaced.

Better would be to return an error message if ( appears in the command.
Or, even better, check if the function is defined when command.scout.ack
is execurted and return a proper error, instead of just executing it
when the ack is received, resulting in an unclear error message.

(Which is why, if you store "led.green(500)" as a command and
substitute that in, you don't get an error.)
That's how it's supposed to work.

Cheers!


Reply to this email directly or view it on GitHub:
#195

@quartzjer quartzjer added the next label Nov 14, 2014
@quartzjer quartzjer self-assigned this Nov 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants