Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Write in Java instead of Lua
Started by mohtadi.elbadoui Nov 18 2019 05:48 AM

1 reply to this topic
java jnlua
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

mohtadi.elbadoui

[GLOBAL: userInfoPane.html]
mohtadi.elbadoui
  • Observer

  • 1 posts
  • Corona SDK

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



[TOPIC: post.html]
#2

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 26,393 posts
  • Enterprise

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




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: java, jnlua