This is an old revision of the document!
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.
advtrains.ms_to_kmh(speed)
speed
(number): a speed unit in meters per secondThe corresponding speed unit in kilometers per hour.
1/1000 km 3600 1 m/s = --------- = ---- km/h = 3.6 km/h 1/3600 h 1000
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
advtrains/helpers.lua, lines 235 to 237:
function advtrains.ms_to_kmh(speed) return speed * 3.6 end