From d0ab05815b7124f745d370af338c2f651e97158d Mon Sep 17 00:00:00 2001 From: HybridDog Date: Wed, 9 Mar 2016 19:00:04 +0100 Subject: [PATCH] fix mistakes in exchange.lua and fix style in exchange_machine.lua --- exchange.lua | 5 ++--- exchange_machine.lua | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/exchange.lua b/exchange.lua index 525fed0..de0f6c2 100644 --- a/exchange.lua +++ b/exchange.lua @@ -819,7 +819,7 @@ function ex_methods.buy(self, p_name, ex_name, item_name, amount, rate) return false, log2_err end - break + remaining = 0 end if remaining == 0 then break end @@ -983,8 +983,7 @@ function ex_methods.sell(self, p_name, ex_name, item_name, amount, rate) return false, log2_err end - break - --revenue = revenue + remaining * row.Rate + remaining = 0 end if remaining == 0 then break end diff --git a/exchange_machine.lua b/exchange_machine.lua index c7fea5e..d4bd2e8 100644 --- a/exchange_machine.lua +++ b/exchange_machine.lua @@ -161,8 +161,8 @@ local function mk_main_fs(p_name, new_item, err_str, success) end -local function show_main(p_name, ...) - minetest.show_formspec(p_name, main_form, mk_main_fs(p_name, ...)) +local function show_main(p_name, new_item, err_str, success) + minetest.show_formspec(p_name, main_form, mk_main_fs(p_name, new_item, err_str, success)) end @@ -220,6 +220,7 @@ end) minetest.register_on_joinplayer(function(player) + -- the inventory list name is "p_"..player_name minetest.get_inventory({ type="detached", name="global_exchange"