From fc6774289e783c43d8189a21a0d197d2da47b982 Mon Sep 17 00:00:00 2001 From: Gregory A Lundberg Date: Sun, 16 Oct 2016 00:41:34 -0500 Subject: [PATCH] Upgrade deprecated Lua loadstring was removed, load does the same thing. atan2 was remvoed, atan works instead --- data/ai/lua/ai_helper.lua | 2 +- data/ai/micro_ais/cas/ca_fast_attack_utils.lua | 2 +- data/lua/wml/random_placement.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/data/ai/lua/ai_helper.lua b/data/ai/lua/ai_helper.lua index 84b980330850..0d8c2862f7b1 100644 --- a/data/ai/lua/ai_helper.lua +++ b/data/ai/lua/ai_helper.lua @@ -544,7 +544,7 @@ function ai_helper.get_angle(from_hex, to_hex) local _, y1cart = ai_helper.cartesian_coords(x1, y1) local _, y2cart = ai_helper.cartesian_coords(x2, y2) - return math.atan2(y2cart - y1cart, x2 - x1) + return math.atan(y2cart - y1cart, x2 - x1) end function ai_helper.get_direction_index(from_hex, to_hex, n, center_on_east) diff --git a/data/ai/micro_ais/cas/ca_fast_attack_utils.lua b/data/ai/micro_ais/cas/ca_fast_attack_utils.lua index eb36d7241053..071e3c0dc535 100644 --- a/data/ai/micro_ais/cas/ca_fast_attack_utils.lua +++ b/data/ai/micro_ais/cas/ca_fast_attack_utils.lua @@ -90,7 +90,7 @@ local function get_attack_filter_from_aspect(aspect, which, data, is_leader) end elseif (aspect.name == "lua_aspect") then --print("Found lua aspect") - local filter = loadstring(aspect.code)(nil, H.get_child(aspect, 'args'), data) + local filter = load(aspect.code)(nil, H.get_child(aspect, 'args'), data) if (type(filter[which]) == 'function') then temporary_attacks_filter_fcn = filter[which] local units = AH.get_live_units(attack_filter(which, { diff --git a/data/lua/wml/random_placement.lua b/data/lua/wml/random_placement.lua index 5a370d454581..ef401ec24a34 100644 --- a/data/lua/wml/random_placement.lua +++ b/data/lua/wml/random_placement.lua @@ -14,7 +14,7 @@ wesnoth.wml_actions.random_placement = function(cfg) local math_abs = math.abs local locs = wesnoth.get_locations(filter) if type(num_items) == "string" then - num_items = math.floor(loadstring("local size = " .. #locs .. "; return " .. num_items)()) + num_items = math.floor(load("local size = " .. #locs .. "; return " .. num_items)()) print("num_items=" .. num_items .. ", #locs=" .. #locs) end local size = #locs