Definition
double,double,double GetLightSpecular(string lightObjectName)
Description
This function returns the specular color of lightObjectName light as three values of red, green and blue. Each value ranges from 0 to 1.
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.
Return Value
Returns the specular color of lightObjectName light as three values of red, green and blue. Each value ranges from 0 to 1.
Example 1
red = 0.0 green = 0.0 blue = 0.0 function Init() red, green, blue = GetLightSpecular("light1") message = string.format("\nLight specular color is > (%.2f, %.2f, %.2f)" , red, green, blue) PrintConsole(message) end function Update() end
In this example, the GetLightSpecular function returns the value of the red, green, and blue components of the specular color of light “light1”. Then these three values are displayed on the console by the PrintConsole function.
Example 2
--Script name is GetLightSpecular2.lua red = 0.0 green = 0.0 blue = 0.0 function Init() red, green, blue = GetLightSpecular("this") message = string.format("\nLight specular color is > (%.2f, %.2f, %.2f)" , red, green, blue) PrintConsole(message) end function Update() end
Assume that the above script named GetLightSpecular2.lua is attached to the light object named “light1”. In this case, string “this” in the GetLightSpecular function will be equal to “light1”. In our example, the function GetLightSpecular returns three values of red, green and blue specular color of the light “light1”.
GetLightSpecular