This will not work as you might expect it. Shaders are reused, not recreated every time the amount of lights changes. The lights arguments are used to specify the maximum amount of lights the shader supports (for calculating specular colors etc). Any additional lights are added to a cubemap, so all lights are always used.