Lua gotchas with custom blizzard.j and common.ai

Level 9
Joined
May 26, 2004
Messages
77
Hi, so small dump of information when modifying blizzard.j and common.ai with custom code and what happens when the map is LUA.

In summary as blizzard.j, common.j and common.ai are still JASS and as mentioned in other threads are being transpiled automatically in some fashion, LUA maps can still call the APIs in them.
But some gotchas I have noticed from AMAI, as well as an outstanding question:

common.ai
  • In Jass mode string operation like substring return a random string from internal string tables in game. But its always the same string returned so you can architect a custom string map to map the internal returned value to be a particular character/text you know it should be.
  • In LUA mode string operations from AI code are blocked and will crash the AI thread.
  • Otherwise natives currently used by both vanilla AI and AMAI are working.
  • Whether there are natives not working in Jass AI but now do in LUA is undiscovered as of yet.

blizzard.j
- In LUA mode the blizzard.j code still runs successfully for most natives at initialization, but registered trigger events in the blizzard.j for players don't seem to work when attempting to trigger the event.
This is where i'm not sure whats happening, as triggers setup within the blizzard.j explicitly do work just fine. But if it requires actions by players e.g type or press a key, the events end up ignored. Presumbly they need to be registering differently somehow but there will be a limitation as blizzard.j is still Jass code? AMAI/Blizzard.eai at master · SMUnlimited/AMAI
The answer/solution to this still to find.


Lua AMAI issue Lua Map Support · Issue #207 · SMUnlimited/AMAI
 
Top