Definition
SetLightDiffuse(string lightObjectName, float red, float green, float blue)
Description
This function sets the diffuse 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 diffuse 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() SetLightDiffuse("light1", 0.25, 0.5, 0.75) end function Update() end
In this example, the SetLightDiffuse function sets the value of the red, green, and blue components of the diffuse color of light “light1” to 0.25, 0.5 and 0.75, respectively.
Example 2
--Script name is SetLightDiffuse2.lua function Init() SetLightDiffuse("this", 0.25, 0.5, 0.75) end function Update() end
Assume that the above script named SetLightDiffuse2.lua is attached to the light object named “light1”. In this case, string “this” in the SetLightDiffuse function will be equal to “light1”. In our example, the function SetLightDiffuse sets the values of red, green and blue components of diffuse color of current light, which is “light1”, to 0.25, 0.5 and 0.75, respectively.
SetLightDiffuse