Convert Ratings

Convert Ratings

80.6k Downloads

Color Picker Error

mynian opened this issue ยท 2 comments

commented
11x [string "ColorPickerOkayButton:OnClick"]:2: attempt to call field 'func' (a nil value)
[string "*:OnClick"]:2: in function <[string "*:OnClick"]:1>

Locals:
self = ColorPickerOkayButton {
 0 = <userdata>
 Text = ColorPickerOkayButtonText {
 }
 Right = <unnamed> {
 }
 Middle = <unnamed> {
 }
 Left = <unnamed> {
 }
}
button = "LeftButton"
down = false
(*temporary) = nil
(*temporary) = "attempt to call field 'func' (a nil value)"

Seems to be looking for an OnClick call for the Okay button, but the example code I used doesn't reference this call at all ..... Probably due to an outdated example, but I can't find anything newer.

commented

moved the code .... got rid of the error.

Now though, it seems to be pulling the color and setting it each time i change anything in the color picker, instead of only updating when "okay" is clicked.

Also, when clicking "cancel" it sets the color to black, instead of doing nothing.

They really need to document this stuff better somewhere ....

commented

The problem lies on your local function myColorCallback location. In order to call that function, it needs to be declared first because you are localling it. In your case, you are creating it at the end of the file, but calling near the top (in function SlashCmdList.CONVERTRATINGS)

There are 2 solutions: bring up the function to the top of your file (or at least before it's called), or make it global (i.e. remove the local keyword).