Controlling light sources?

So, I’ve been browsing around these forums for GLSL samples. There are a lot of cool things out there but they all require light sources. As I’ve understood you can get the light source in two ways.

Either using gl_LightSource[n] or passing it manually with something like:

lamp = objects[‘OBLamp’]

#in def main
shader.setUniformfv(‘light_position’, lamp.getPosition())

#in vertex shader
uniform vec3 light_position;

Now, this is fine for single room scenarios. What if I want to move on to the next room that should also be lit? Will gl_LightSource[n] automatically figure out what lights to use? How do I tell it which ones to use?

I also ran into the problem where I had a shader using gl_LightSource[n] where n=1…3 (i.e. 3 light sources). But when I didn’t have 3 light sources in my level it well… obviously didn’t work well and lit everything up in a weird way. Is it possible to make the shader detect that there was no light source there?