From 5be77fa63dcdba88e1418eeea50d81fa462a52fe Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Fri, 16 Dec 2016 08:09:53 -0600 Subject: [PATCH 1/2] stockflow: Fix "integer expected" problem in stockflow --- plugins/lua/stockflow.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/lua/stockflow.lua b/plugins/lua/stockflow.lua index 6027bb455..510718ff1 100644 --- a/plugins/lua/stockflow.lua +++ b/plugins/lua/stockflow.lua @@ -1137,6 +1137,7 @@ function check_stockpiles(verbose) local filled, empty = check_pile(spec.stockpile, verbose) local amount = trigger.filled and filled or empty amount = (amount - (amount % trigger.divisor)) / trigger.divisor + amount = math.floor(amount) result[reaction] = (result[reaction] or 0) + amount end end From 1419d58b9a6d074edb0d56deda62f5f2e4f12852 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Fri, 16 Dec 2016 13:04:51 -0600 Subject: [PATCH 2/2] stockflow: Use "floor division" Per suggestion by @dscorbett --- plugins/lua/stockflow.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/lua/stockflow.lua b/plugins/lua/stockflow.lua index 510718ff1..32fc342fb 100644 --- a/plugins/lua/stockflow.lua +++ b/plugins/lua/stockflow.lua @@ -1136,8 +1136,7 @@ function check_stockpiles(verbose) local reaction = spec.entry.ints[entry_ints.order_number] local filled, empty = check_pile(spec.stockpile, verbose) local amount = trigger.filled and filled or empty - amount = (amount - (amount % trigger.divisor)) / trigger.divisor - amount = math.floor(amount) + amount = (amount - (amount % trigger.divisor)) // trigger.divisor result[reaction] = (result[reaction] or 0) + amount end end