Passing itemlinks to slash commands
I am wanting to pass an itemlink to a slash command such as
Code:
/fs add <Linen Cloth> Presently I am add Code:
SLASH_SERVANT1 = "/fs" |
arg1 is the full command. Skip the 'add'.
|
Quote:
Func does return add when printed, so that's not a problem. |
To expand further on Rilgamon's post, slash commands pass everything after the actual command into only the first variable. arg1 is nil here.
In your function, Lua Code:
and Lua Code:
which means you are doing Lua Code:
which causes the error. If you want add/remove commands, you have to "take apart" the first variable. One common method is Lua Code:
where Lua Code:
and Lua Code:
|
Presently I am using
Code:
SLASH_SERVANT1 = "/fs" link = not a thing nor BugSack error |
Try:
Code:
SLASH_SERVANT1 = "/fs" |
Mkay, that got me on track.
|
You were likely linking an item that had a space in it, when testing with Kanegasi's code.
strsplit accepts an optional 3rd argument that defines how many pieces to make. https://wow.gamepedia.com/API_strsplit You can still use Kanegasi's simpler method like this. Lua Code:
|
All times are GMT -6. The time now is 08:40 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI