Map Pin Enhanced

Map Pin Enhanced

10k Downloads

/way command fails when title contains a number

aloop opened this issue ยท 1 comments

commented

Describe the bug
When using a /way command with a title containing a number, e.g. /way #114 88.07 34.60 Torn Diary, Page 6, the command fails with Invalid mapID: #114 Torn Diary Page. If I remove the "6" from the command, it works perfectly fine.

Was it working in a previous version?

I believe so? Not sure when it was broken.

Additional context

I believe the culprit lies in the following check in wayCommand.lua:

if (type(tonumber(tokens[idx])) == "number" or string.find(tokens[idx], "%d" .. decimal_separator .. "%d")) then
    break

The loop it's contained in iterates over the command tokens in reverse, and when it hits the 6 it breaks the loop, leaving the rest of the title in the tokens table.

I think parsing the tokens from beginning to the end may make more sense here? Then once you've matched the mapID or zone name (if present) and the two coords you can just assume all remaining tokens are the title. I'm not very familiar with all of the ways that the formatting of these commands may vary though, so maybe you have reasons for doing it this way.

commented

Fixed in version 3.0.9. Thanks for bringing this up!