Follow-up Comment #5, patch #1432 (project wesnoth):

I don't see any obvious mistake on the Lua side. I would have used a much
lighter setting for the stages though; instead of having a whole Lua snippet,
just allow a method name. That way, all the Lua code for a given AI is created
from a single place, e.g. an external file for instance.


[ai]
    id = ai_lua
    description = Lua Test AI version 2
    version = 10710
    [engine]
       name = lua
       code = <<
local my_ai = { side = ... }
function my_ai:move_full(FROM, TO)
  wesnoth.ai_execute_move(self.side, FROM.x, FROM.y, TO.x, TO.y, 1)
end
function my_ai:my_stage()
  self:move_full({x = 15, y = 2}, {x = 11, y = 4})
end
return my_ai
>>
    [/engine]
    [stage]
        engine = lua
        method = my_stage
    [/stage]
[/ai]


(The ":" character is just syntactic sugar for a "self" implicit first
argument, OO-style.)

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1432>

_______________________________________________
  Message posté via/par Gna!
  http://gna.org/


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

Reply via email to