With this Lua support, would it be possible to affect the AI decisionmaking by outside software (like neural networks)?
Theoretically yes, although we don't need Lua for that... I could make a call to an external engine and pass the entire savegame as a parameter in C++ too... wouldn't take more than a day. If we count also parsing the response from the service and acting on it, probably 2-3 days.
But:
1/ Who is going to implement that neural network?
2/ I have never done a neural network, but I understand some basic principles. It would probably take a few years to implement just the input-creating program, nothing to do with neural networks or machine learning yet (parse the whole savegame, digest it and prepare a simplified input for the neural network). Assuming preparing such simplified input is even possible (without losing too much detail, or sanity), add a few more years to implement (or better said invent) a suitable neural network.
3/ Once you have that, add about a 100 years, give or take a decade, to train it.
4/ Once trained to process the input and make a decision in let's say 1 second... happy waiting each time it is called (several hundred or thousand times per turn)
Jokes aside, it took a decent sized team of world class scientists several years to create AI that can play poker well enough to beat human players (beat = win in a bit more than 50% of cases).
I'd guesstimate that Xcom is about a million times more complicated than poker.
I don't have any numbers on how many hundreds/thousands of people worked on self-driving cars for how many decades... but an engine capable of solving Xcom would not be simpler than a self-driving car either. Good luck
PS: unless -- as @Whisper says -- you just want to take existing partial decision at some point of decision making (e.g. just before rolling dice on x% attack, y% patrol, z% ambush and w% retreat... which is the tightest bottleneck in the process I can think of) and tweak those 4 numbers by some magic (or neural network) into a different set of four numbers... but I guess RNG does a good job at that, so you'll probably want a slightly more complicated breakpoint
PPS: in one sentence: A scripting engine (be it Y-scripts or Lua-scripts or anything else) allows you
- to pause the program's execution (at points decided by the script engine creator),
- access the program's variables (only those that the script engine creator gives you),
- do some math using some language on those variables (that's the only difference between Y-scripts and Lua-scripts),
- and return some modified variables to the program... after which it will resume its execution (btw. the variables you can return are also just what the script engine creator gives you).