exercism.org/lua/lasagna/lasagna.lua
2024-03-24 18:37:22 +01:00

26 lines
817 B
Lua

local lasagna = {}
-- add a 'oven_time' field to the lasagna table
lasagna.oven_time = 40
-- returns the remaining minutes based on the actual minutes in the oven
function lasagna.remaining_oven_time(actual_minutes_in_oven)
return lasagna.oven_time - actual_minutes_in_oven
-- remaining_oven_time body
end
-- calculates and returns the time needed to prepare the lasagna on the amount
-- of layers
function lasagna.preparation_time(number_of_layers)
return number_of_layers * 2
-- preparation_time body
end
-- calculates the time elapsed cooking the lasagna - including preparation time
-- and baking time.
function lasagna.elapsed_time(number_of_layers, actual_minutes_in_oven)
return lasagna.preparation_time(number_of_layers) + actual_minutes_in_oven
-- elapsed_time body
end
return lasagna