Write in Java instead of Lua

I am new to corona, and saw that there is a possibility to write the script in java rather than Lua. I tried to look for guides to help me set this up, but I didn’t manage to achieve this.

Is there any detailed guide out here, or can someone help me with the steps to get this working?

I got as far as installing jslua-1.0.4

Hi @mohtadi.elbadoui and welcome to the Corona forums.

First it appears that jslua is a tool that converts JavaScript to Lua. JavaScript isn’t Java. They are entirely different languages that share a name and some C-like syntax. After that, they are pretty radically different in how they work.

jslua seems to let you write in JavaScript, run some code that turns it into Lua. I don’t know of any one doing that. You probably could figure out a way to map JavaScript functions to where they could be converted to Corona API functions, but this seems like something way more difficult than the value you would get out of using JavaScript. I’m assuming that you’re familiar with JavaScript and not with Lua. If that’s the case, you’re going to have to know a lot about Lua to make this work for you and it’s not going to integrate with Corona very well. You would have to run a script to convert it and hope the simulator can read the files. Errors are going to come back to you in Lua, not JavaScript. I would not recommend going down this route.

Now if you want to use Java, Corona can use Java, but in a very limited way using a feature called Corona Native. With Corona Native, you still write your core app in Lua, calling all of the Corona APIs, but when we don’t have APIs, you can extend Corona by creating your own APIs in Java, using Android Studio to build the app and the Java-to-Lua bridge to let your Java code talk to the Lua code. But 95% of your app will still be in Lua.

If this is what you want, I can point you to some topics to get you started.

Rob