It's a shame, then, I really don't mind redoing each trigger manually, because I'm just learning and that can help me, my problem was precisely the objects.There are some ways but they aren't flawless. If you are using vJass you will lose all of the objects and such, being left with only the compiled JASS.
I'm just learning about Lua, I can't learn another language. Also, does W3 support it?There is also an option if you are willing to try TypeScript, which is in my opinion superior to Lua.
s
, Jass would compute s + null
to s
, while lua computes s .. nil
to nil
. That can't be solved by a converter, but you would have to find such an after-conversion-bug on your own.Wc3 doesn't natively support Typescript, but you would have to use external software to convert your Typescript code to lua, before pasting it into your map. There are even tools that do both the conversion and the pasting for you. And in contrast to Jass -> lua, those conversions should be quite bugfree.Also, does W3 support it?
I wrote my own jass to lua transpiler which should handle string concatenation correctly: Map TranspilerVersion 1.12 of cJass2Lua can be retreived here: goshante/cjass2lua
I have used that tool to convert my Jass triggers and was happy enough with the results, although (like TriggerHappy pointed out) those conversions are never flawless.
In my example, string concatenation was converted wrongly in a lot of cases, when the concatenation involved more than two elements (should have converted second and further "+" into "..", but didn't).
Also, you might encounter a few bugs coming from lua and Jass handling a few things differently. For instance, given a string
s
, Jass would compute
s + null
to
s
, while lua computes
s .. [COLOR=color: #666666]nil[/COLOR]
to
nil
. That can't be solved by a converter, but you would have to find such an after-conversion-bug on your own.
If we're going to argue about which programming language is superior, allow me to link this as well: [C#] Mapmaking in csharpHowever, I don't share TriggerHappy's opinion of Typescript being superior to lua.
If you need typesafety, you can pseudo-achieve it by using linting tools such as sumneko's lua extension for Visual Studio Code (which however requires you to annotate your code properly). And lua offers functions to properly debug your code and print useful error messages, when having used Wc3 natives with wrong inputs.
__index
-function and the :
-operator.But the problem is in the moment I change a trigger to a custom script I can't change the programming language.Ok, I see. Sorry, you have to rewrite your vJass-Code manually to lua.
Luckily, Lua offers multiple ways of programming in an object oriented way, although the language itself is not object oriented. The most common way involves the__index
-function and the:
-operator.
Is that works?Copy all triggers to clipboard and then change script language. Paste back all triggers. Viola! That's it.