function sleep(seconds)
local co = coroutine.running()
local timer = os.time() + seconds
while os.time() < timer do
coroutine.yield()
end
end
function Myfunction()
local startWeight = 100 * math.random()
while true do
local cStamp = os.time()
local dateTable = os.date("*t", cStamp)
if dateTable.sec % 5 == 0 then
print(dateTable)
local endWeight = startWeight + 100 * math.random()
local dayProduction = endWeight - startWeight
startWeight = endWeight
print("production", dayProduction / 100)
coroutine.wrap(function()
sleep(1)
end)()
end
coroutine.yield()
end
end
coroutine.wrap(function()
Myfunction()
end)()