Author: anonymissimus
Date: Sat Oct 15 23:05:00 2011
New Revision: 51505

URL: http://svn.gna.org/viewcvs/wesnoth?rev=51505&view=rev
Log:
made scope of this_unit variable in modify_unit local (bug #18811)

Modified:
    trunk/data/lua/wml-tags.lua

Modified: trunk/data/lua/wml-tags.lua
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/lua/wml-tags.lua?rev=51505&r1=51504&r2=51505&view=diff
==============================================================================
--- trunk/data/lua/wml-tags.lua (original)
+++ trunk/data/lua/wml-tags.lua Sat Oct 15 23:05:00 2011
@@ -575,11 +575,21 @@
        wml_actions.store_unit { {"filter", filter}, variable = unit_variable, 
kill = true }
        local max_index = wesnoth.get_variable(unit_variable .. ".length") - 1
 
+       local this_unit = helper.get_variable_array("this_unit") --containers 
and arrays
+       if #this_unit == 0 then this_unit = wesnoth.get_variable("this_unit") 
end --scalars (and nil/empty)
+
+       wesnoth.set_variable("this_unit")
        for current_unit = 0, max_index do
                handle_unit(current_unit)
        end
-
        wesnoth.set_variable("this_unit")
+
+       if type(this_unit) == "table" then
+               helper.set_variable_array("this_unit", this_unit)
+       else
+               wesnoth.set_variable("this_unit", this_unit)
+       end
+
        wesnoth.set_variable(unit_variable)
 end
 


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to