From 5fdb73b92f9b5fe7ff9a629c27f49289694469c8 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sun, 11 Dec 2016 18:06:51 -0500 Subject: [PATCH] Fix an error in [for] if step not specified --- data/lua/wml-flow.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/data/lua/wml-flow.lua b/data/lua/wml-flow.lua index dcb65d0f3fca..1b1806c8068d 100644 --- a/data/lua/wml-flow.lua +++ b/data/lua/wml-flow.lua @@ -120,14 +120,16 @@ wesnoth.wml_actions["for"] = function(cfg) local sentinel = loop_lim.last if loop_lim.step then sentinel = sentinel + loop_lim.step + if loop_lim.step > 0 then + return wesnoth.get_variable(i_var) < sentinel + else + return wesnoth.get_variable(i_var) > sentinel + end elseif loop_lim.last < first then sentinel = sentinel - 1 + return wesnoth.get_variable(i_var) > sentinel else sentinel = sentinel + 1 - end - if loop_lim.step > 0 then - return wesnoth.get_variable(i_var) < sentinel - else return wesnoth.get_variable(i_var) > sentinel end end