Definition
bool IsWaterSunReflectionEnabled(string waterName)
Description
This function determines whether the sun reflection of water waterName is enabled or not.
Parameters
waterName
Specifies the water name. You can also use the name “this” for this parameter. In this case, “this” string refers to the name of the water to which this script is attached.
Return Value
If sun reflection of water waterName is enabled, it returns true, otherwise it returns false.
Example 1
waterSunReflection = false message = "" function Init() waterSunReflection = IsWaterSunReflectionEnabled("water1") if waterSunReflection then message = string.format("\nWater sun reflection is enabled") else message = string.format("\nWater sun reflection is't enabled") end PrintConsole(message) end function Update() end
First, we determines whether the sun reflection of water “water1” is enabled or not. Then we display its result in the console using the PrintConsole function.
Example 2
--Name of script is iswatersunreflectionenabled2.lua waterSunReflection = false message = "" function Init() waterSunReflection = IsWaterSunReflectionEnabled("this") if waterSunReflection then message = string.format("\nWater sun reflection is enabled") else message = string.format("\nWater sun reflection is't enabled") end PrintConsole(message) end function Update() end
Assume that the above script named iswatersunreflectionenabled2.lua is attached to a water object named “water1”. In this case, string “this” in the IsWaterSunReflectionEnabled function will be equal to “water1”. In our example, the function IsWaterSunReflectionEnabled determines whether the sun reflection of current water, which is water “water1”, is enabled or not. then we display its result in the console using the PrintConsole function.
IsWaterSunReflectionEnabled