I am having issues attempting something, reducing animal “feed” in real time when the app is closed.
Right now I have this:
local feedAmount = 100;
Then, what I want to do is reduce the amount of feed by 10 units per hour. However for testing purposes I am reducing it by 10 per second. To do this, I used a timer and repeat it every 10 seconds, thus reducing the feed amount.
local function reduceFeed(); if feedAmount == 100 then; feedAmount = feedAmount - 10; elseif feedAmount == 0 then; end; end; timer.performWithDelay( 1000, reduceFeed, [-1] );
However, I don’t know how to attempt this while the app is closed. I have tried several things with
os.time
but cannot find a solution. If I was steered in the correct path as far as how I am to go about this, it would certainly help. Running from a server is not an option.
Thank you for your assistance.