Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
local KG2LBS = 2.20462262185
local ROUND = 100
local USE_POUNDS = true
local PRECISION = 1 / (USE_POUNDS == true and KG2LBS or 1) * ROUND
function ceil_to_prescision(value)
return math.ceil(value / PRECISION) * PRECISION
end
local FUEL = {}
function FUEL:new(value)
local self = {}
self.value = ceil_to_prescision(value)
function self:print()
print(self.value, USE_POUNDS and (self.value * KG2LBS) or "")
end
return self
end
print(PRECISION)
local F1 = FUEL:new(776.3344)
F1:print()
local F2 = FUEL:new(F1.value)
F2:print()
local F3 = FUEL:new(F2.value)
F3:print()
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more