The most simple light sensor is a light dependent resistor (LDR). It costs almost nothing, and serves its purpose. The following drawing shows how to connect an LDR to the analog input port from the ESP. You need the pulldown resistor (10kΩ in our case) in order to get a valid signal. Values are between 0 (total darkness) and 1023 (bright).
The following code snippet shows how to use a timer to repeatedly read the light value every 5 seconds and print it to the console.
-- continuously poll light intensity -- tmr.alarm(4,5000,tmr.ALARM_AUTO, function() local light_value = adc.read(0) print("Light value: " .. light_value) end)