Closed Jampi0n closed 2 years ago
I managed to change my map, so it works in lua. The most prevalent issue is mentioned above. In particular this construct does not work: let tmp = HashMap.get(key) if tmp != null This can be fixed using HashMap.has(key) before.
Additionally using null as string does not work.
For the first issue, there is likely no good solution, other than updating the code and check whether the key exists first. I assume null strings can work by simply replacing null with "", when compiling to lua (is there a difference between null and "" in jass?)
The standard library uses the HashMap as shown above, so it can lead to issues. It also uses null as string, so at the moment FrameHandle.wurst cannot initialize.
Thanks for the report.
The thing with nulls and strings is something I thought was working. We have some test cases testing different combinations of using null
here: https://github.com/wurstscript/WurstScript/blob/d79f738cfee4d10e288097755d17b165985c3c39/de.peeeq.wurstscript/src/test/java/tests/wurstscript/tests/BugTests.java#L1083-L1123
Can you show an example where null as string does not work?
I'll also look at the HashMap problem. Maybe that will already fixed by the upcoming changes in #931 .
Using the FrameHandle package leads to an error, because it uses
let mouseCage = createFrame("FRAME", "SetMousePositionCage", GAME_UI, null, 0)
in line 389. Here, null is used as parameter for a native function that expects a string.
So using that package, you get an error with the string. For example with this code: https://bin.wurstlang.org/viyirecelo.wurst
On a related note, I found an issue when I tried to create a minimal example with the string problem. If I add the imports NoWurst and Framehandle to minimize the produced code, the map doesn't start in lua mode (JASS works fine). I only get the screen with the lordaeron lion. Code: https://bin.wurstlang.org/epuhotezaj.wurst
seems resolved.
I tried the -lua run argument in my map and it produced errors during the initialization. One of the issues I found is, that functions can return nil instead of the specified type, possibly leading to errors, when using the returned value.
code to reproduce: https://bin.wurstlang.org/ajosinetib.wurst
Could be related to #869