User Tools

Site Tools


Sidebar



Minetest Forum
Content Database
Git Repository
Bug Tracker
Website

dev:core:funref:ms_to_kmh

This is an old revision of the document!


advtrains.ms_to_kmh

Converts a speed unit in meters per seconds to kilometers per hour.

Note: this page has been written for Advtrains 2.0.1 TSS and Minetest 5.1.0. Examples and practices described in this page don't take advantage of improvements introduced in later releases.

Syntax

advtrains.ms_to_kmh(speed)

Parameters

  • speed (number): a speed unit in meters per second

Returns

A speed unit in kilometers per hour.

Examples

advtrains.ms_to_kmh(1)  -- 3.6 km/h
advtrains.ms_to_kmh(3)  -- 10.8 km/h
advtrains.ms_to_kmh(20) -- 72 km/h
advtrains.ms_to_kmh(25) -- 90 km/h

In source code

advtrains/helpers.lua, lines 235 to 237:

ms_to_kmh.lua
function advtrains.ms_to_kmh(speed)
	return speed * 3.6
end
dev/core/funref/ms_to_kmh.1570030805.txt.gz · Last modified: 2019-10-02 17:40 by 82.67.173.193