The error is in the SetScript on line 149. SetScript accepts 2 parameters, the script and the function that should be called.
Code:
cb:SetScript("OnClick", setLoc(i))
This will generate an error This will happen if the onclick handler is called:
Errors. This IS correct:
Code:
cb:SetScript("OnClick", function(i) setLoc(i) end)
Which will be called like this(
function:2FJ39 is the link to the local function created by
function(i) setLoc(i) end):
Code:
function:2FJ39(...)
And the most neat way is this:
Code:
cb:SetScript("OnClick", setLoc)
Which will get called like this:
Which is what we want.
Final thing, you are concatenating the
i variable in your setLoc function, don't you mean this?