Addon Error

Hello, I just created an addon for Garry’s Mod. Everything is working perfectly except I am receiving two different errors.


[ERROR] lua/includes/util.lua:33: bad argument #1 to 'min' (number expected, got nil)
  1. min - [C]:-1
   2. Color - lua/includes/util.lua:33
    3. unknown - addons/testaddon/lua/entities/testaddon/cl_init.lua:219


[ERROR] lua/includes/extensions/math.lua:198: attempt to compare two table values
  1. Approach - lua/includes/extensions/math.lua:198
   2. unknown - addons/testaddon/lua/entities/testaddon/cl_init.lua:45

Here is the source code.


//Line 219
Col = Color(self.R, self.G, self.B, Alpha)
//Line 45
self.R = math.Approach(self.R, R, App)

I tried everything, but I just keep getting errors.

“Hi, my addon doesn’t work, heres the error I am getting and here are 2 lines of code that are useless without rest of the code, but I’ll post it anyways”
Sorry, couldn’t resist

Generally colors are rgba not RGBA when doing something like Color.r

Ex:


ColorRed = Color(255,0,0,255)
Red = ColorRed.r
Blue = ColorRed.b
Green = ColorRed.g
Alpha = ColorRed.a

It doesn’t really matter, only the order matters.
It’s like arguments in functions.

Also he isn’t calling a variable holding color, hes using “self” and according to that and the file position, hes calling an entity.