View Single Post
08-06-18, 02:11 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
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:
  1. func == "add <Linen Cloth>"

and

Lua Code:
  1. arg1 == nil

which means you are doing

Lua Code:
  1. GetItemInfo(nil)

which causes the error.


If you want add/remove commands, you have to "take apart" the first variable. One common method is

Lua Code:
  1. SlashCmdList.SERVANT = function(input)
  2. local command, link = strsplit(" ", input)

where

Lua Code:
  1. command == "add"

and

Lua Code:
  1. link == "<Linen Cloth>"
  Reply With Quote