GetWaterFlowSpeed

Definition

double GetWaterFlowSpeed(string waterName)

Description

This function returns the flow speed of water object waterName.

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

Flow speed of water object.

Example 1

speed = 0.0

function Init()
    speed = GetWaterFlowSpeed("water1")

    message = string.format("\nWater flow speed is > %.2f", speed)
    PrintConsole(message)
end

function Update()

end
First, we get the flow speed of water “water1”. Then we display the water flow speed in the console using the PrintConsole function.

Example 2

--Name of script is GetWaterFlowSpeed2.lua

speed = 0.0

function Init()
    speed = GetWaterFlowSpeed("this")

    message = string.format("\nWater flow speed is > %.2f", speed)
    PrintConsole(message)
end

function Update()

end
Assume that the above script named GetWaterFlowSpeed2.lua is attached to a water object named “water1”. In this case, string “this”  in the GetWaterFlowSpeed function will be equal to “water1”. In our example, the function GetWaterFlowSpeed returns the flow speed of current water, which is “water1”.
adminGetWaterFlowSpeed