You get the id when adding the light to the World by using addLight() as a return value. Again: I agree that it would be better to handle lights as instances of their own, but just write yourself a Light-class that takes a World in the constructor and internally adds a new light to this world and holds the id. Manipulate the light by mapping the methods of your class to the corresponding ones in World. For example: Currently, there is no way to remove a light from the World, so just add a method disable() to your Light class and let it call World.setLightVisibility(myID, false). Got the idea?
Edit: rolz owned me... :lol: