Hi, so im working on JBlox which is just an interpreter for java in roblox.
Yeah so you can code in Java basically.
heres an example code:
local JBlox = require(script.Parent.JBlox)
JBlox.JRun([[
import roblox.*;
public class SpawnPart {
public static void main(String[] args) {
String myString = new String("Hello");
int myInt = new int(42);
char myChar = new char("A");
double myDouble = new double(3.14);
Color3 myColor = new Color3("Bright blue");
BrickColor myBrickColor = new BrickColor("Bright red");
Vector3 myVector = new Vector3(10, 10, 5);
Instance myPart = new Instance("Part");
myPart.Anchored = true;
myPart.Size = myVector;
myPart.BrickColor = myBrickColor;
myPart.Parent = workspace;
}
}
]])
heres the early version module with lots of errors:
JBlox.lua (3.3 KB)
18 Likes
Curious, is this for like a project ? IF you want access to types and such, why not use use typed Luau?
I am not saying what you have done is not cool, just curious as to what is gained by doing it this way?
2 Likes
i thought it may be easier for java/C# devs to maybe transfer to roblox by using the java syntax
2 Likes
Check out MiddleClass on github. I came from C# and it made working won’t lua like 1000x easier to me. I rave that its the perfect OOP language, and it even comes with self checking like an instance to registered classes in the core module.
It has just the right sugar, and robust implementation to not be too much overhead for class definition but enough to be readable and informative.
But again, I applaud the practice its always cool to see things like that. =-)
2 Likes
Awesome! Get this on Github. I’ll contribute something to it.
2 Likes
OMG I LIKE PROGRAMMING IN JAVA AND SUFFER BY 192891919 EXCEPTIONS
IMA USE THIS VERY 10/10 THING
complete sentence
2 Likes
I recommend using Lux for the grammar
3 Likes
seriously java in roblox?, reply “…” if you are kidnaped
10 Likes
2jammers
(2jammers)
July 15, 2024, 3:41pm
#9
creating a massive compatibility layer for a language everyone hates is wild
4 Likes
you should make a transpiler to convert java to lua code, instead of interpreting the java code during runtime, here’s why:
performance is going to be a lot better since the interpreting is already done beforehand
there will be no need for loadstring
to be enabled (security risk & performance is going to further suffer)
type annotations & plugins can be used because the java code can be written in an actual IDE instead of a string
you should take a look at roblox-ts because it’s a similar project to yours
2 Likes
especially for minecraft mod makers who are using roblox (random situation)
1 Like
but then it’s not gonna be like actual java!
Question, why do you use a .LUA file if you can only import RBXL and RBXM
2 Likes
I appreciate how you’re encouraging more developers to join the Roblox platform by allowing them to continue coding in their preferred languages. Hopefully, many developers from other platforms will see this and be inspired to join.
1 Like
but then it’s not gonna be like actual java!
i am not sure what you mean by this, please regard my last point
type annotations & plugins can be used because the java code can be written in an actual IDE instead of a string
by using a transpiler, you will be able to write actual java code with a java ide, instead of blindly writing it in a string
additionally, there will be no performance losses because the transpiler should output luau code
1 Like
They were referring to poor performance
2 Likes
2jammers
(2jammers)
August 2, 2024, 2:36pm
#18
thats not how it works sir, i think you forgor about the translation part
1 Like
i wasn’t wrong about anything, please look at roblox-ts because it’s exactly i’ve just described
2 Likes
2jammers
(2jammers)
August 3, 2024, 3:16am
#20
??? roblox-ts does not do real time compilation