Quantcast
Channel: The Battle for Wesnoth Forums
Viewing all articles
Browse latest Browse all 1181

Lua Labs • wml.get_child for unit

$
0
0
hi,
I am trying to iterate over the modifications of a unit to get a specific modifications (trait) but I got an error "except a lua or wml table but get unit".
how to fix that? and if someone can tell why is it wrong?

Code:

local u = wesnoth.units.find_on_map{ id = selected_unit_id_alpha }[1]for _, eff in ipairs(world_items_list) doif eff.world_item_id == item_id_to_give then-- addedlocal modifications = u, "modifications")for i = 1,#modifications doif modifications[i][1] == "trait" thenif modifications[i][2].id == "student" thenprint("unit: student")endendendend

Statistics: Posted by hermestrismi — Yesterday, 8:18 pm



Viewing all articles
Browse latest Browse all 1181

Trending Articles