Definition
SetLightAmbient(string lightObjectName, float red, float green, float blue)
Description
This function sets the ambient color of lightObjectName light as three values of red, green and blue. Each value ranges from 0.0 to 1.0.
Parameters
lightObjectName
Specifies the name of the light object. You can also use the name “this” for this parameter. In this case, “this” refers to the light object name to which this script is attached.
red, green, blue
Specify the ambient color of lightObjectName light as three values of red, green and blue. Each value ranges from 0.0 to 1.0.
Example 1
function Init() SetLightAmbient("light1", 0.25, 0.5, 0.75) end function Update() end
In this example, the SetLightAmbient function sets the value of the red, green, and blue components of the ambient color of light “light1” to 0.25, 0.5 and 0.75, respectively.
Example 2
--Script name is SetLightAmbient2.lua function Init() SetLightAmbient("this", 0.25, 0.5, 0.75) end function Update() end
Assume that the above script named SetLightAmbient2.lua is attached to the light object named “light1”. In this case, string “this” in the SetLightAmbient function will be equal to “light1”. In our example, the function SetLightAmbient sets the values of red, green and blue components of ambient color of current light, which is “light1”, to 0.25, 0.5 and 0.75, respectively.
SetLightAmbient