command separator incorrectly parsed

Post Reply
zhenzh
Posts: 50
Joined: Fri Apr 17, 2020 2:23 am

command separator incorrectly parsed

Post by zhenzh »

When I try running lua send() from input command line, separators were parsed incorrectly.

For example, I'm using ; as separator and will send a batch of commands from lua.
I used:

Code: Select all

lua send("north;north;north")
While the command was considered as send("north, north, north") 3 parts which lead to input failure.

It would be better to avoid separators being parsed within a pair of "

User avatar
Vadi
Posts: 4854
Joined: Sat Mar 14, 2009 3:13 pm

Re: command separator incorrectly parsed

Post by Vadi »

For this particular example you can use the speedwalk function: https://wiki.mudlet.org/w/Manual:Mapper ... #speedwalk

lua speedwalk("north,north,north")

zhenzh
Posts: 50
Joined: Fri Apr 17, 2020 2:23 am

Re: command separator incorrectly parsed

Post by zhenzh »

How about the other non-walk comands?
When I try to do send("north;look;south")

User avatar
Vadi
Posts: 4854
Joined: Sat Mar 14, 2009 3:13 pm

Re: command separator incorrectly parsed

Post by Vadi »

Don't use send? It's redundant - just type north;look;south - and you get the result :)

zhenzh
Posts: 50
Joined: Fri Apr 17, 2020 2:23 am

Re: command separator incorrectly parsed

Post by zhenzh »

I use send here for there are some additional lua judgement around, for example:

Code: Select all

if string.match(line, "north") then
    send("north;look;south")
else
    send("south;look;north")
end
Besides, the # repeat script may also be impacted.
When I run #3 north;look to expect the result north;look;north;look;north;look

User avatar
Vadi
Posts: 4854
Joined: Sat Mar 14, 2009 3:13 pm

Re: command separator incorrectly parsed

Post by Vadi »

This seems like it should go into an alias, not the input line, don't you think?

zhenzh
Posts: 50
Joined: Fri Apr 17, 2020 2:23 am

Re: command separator incorrectly parsed

Post by zhenzh »

Yes, it can be processed in an alias as a work around.
Just wonder whether there will be a better solution as some times I may run a batch of lua commands from input cli for debugging.
I have to create some temp aliases and edit them again and again for different trouble shooting purpose. Updating lua from input directly will be much more convenient.

User avatar
Vadi
Posts: 4854
Joined: Sat Mar 14, 2009 3:13 pm

Re: command separator incorrectly parsed

Post by Vadi »

Changing the command separator to something else would do the trick - like ;;

zhenzh
Posts: 50
Joined: Fri Apr 17, 2020 2:23 am

Re: command separator incorrectly parsed

Post by zhenzh »

Then, the send command will also be changed to send("north;;look").
Or, the "north;look" will be considered as the entire string and the ; will not be parsed as separator.

User avatar
Vadi
Posts: 4854
Joined: Sat Mar 14, 2009 3:13 pm

Re: command separator incorrectly parsed

Post by Vadi »

Yes, that's what you want, correct?

If you'd like to send separate commands, the right way to do this is to use sendAll()

Post Reply