Definition
bool IsWaterShadowEnabled(string waterName)
Description
This function determines whether the shadow of reflections 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 shadow of reflections of water waterName is enabled, it returns true, otherwise it returns false.
Example 1
waterShadow = false message = "" function Init() waterShadow = IsWaterShadowEnabled("water1") if waterShadow then message = string.format("\nWater shadow is enabled") else message = string.format("\nWater shadow is't enabled") end PrintConsole(message) end function Update() end
First, we determines whether the shadow of reflections 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 IsWaterShadowEnabled2.lua waterShadow = false message = "" function Init() waterShadow = IsWaterShadowEnabled("this") if waterShadow then message = string.format("\nWater shadow is enabled") else message = string.format("\nWater shadow is't enabled") end PrintConsole(message) end function Update() end
Assume that the above script named IsWaterShadowEnabled2.lua is attached to a water object named “water1”. In this case, string “this” in the IsWaterShadowEnabled function will be equal to “water1”. In our example, the function IsWaterShadowEnabled determines whether the shadow of reflections of current water, which is water “water1”, is enabled or not. then we display its result in the console using the PrintConsole function.
IsWaterShadowEnabled