Python has the built in libraries on GitHub, you will have to copy paste them on your own.
All wally and rbxts packages are supported, roblox-pyc has its own registry of python designed packages. Also pip packages are supported, only ones that use 100% python. If it uses C/C++ and you do not have beta mode enabled it will error.
Okay, so the current version is pretty buggy, and slow.
Part of the problem is because I didnāt bother to write modularized code, halfway through I did split it to ~12 different python scripts but the python interpreter is so slow. So this time I will be rewriting it inā¦ C, C++, and a heavily modded version of lua.
With these changes I will also remove it from PyPi (pip) and just have standalone executables available.
I have a whole announcement on the discord server and a step-by-step plan on Github Issues.
This is really cool, I only use roblox luau cause there are no other languages and I miss c++ here. Sad so this only compiles to luau and has no performance gainsā¦
I havenāt used any compiling tools like roblox-ts yet, but I did hear that the compiling of roblox-ts is not always accurate. Can I trust this tool for my game development?
roblox-rs exists that can convert Rust WASM to Luau. obviously it is not going to have good performance, since it is being based on compiling Assembly to a High-level language.
I want to do this but I am quitting roblox development and might pass ownership of this project to someone else after I rewrite some systems.
The compiler is very accurate but the interface is difficult to get started with since it is a pip package and that stopped alot of people from using it, standalone executables are coming soon tho.
Compiling from Lua to Python is not the point of this project, the %s is supposed to be the old code as a reference for you to manually rewrite in Python then compile again using roblox-pyc to Lua.
It is available but since roblox-pyc split up into multiple compilers it is not apart of roblox-pyc anymore.
Very little examples are provided because this is an experimental but it has a list of which C and C++ features are supported.
Here is a Fibonacci sequence test I did a while ago:
#include "src/rbx.h"
int fibonacci(int n) {
if (n <= 1) {
return n;
} else {
return fibonacci(n-1) + fibonacci(n-2);
}
}
int main() {
int n = 10;
for (int i = 0; i < n; i++) {
print((char *)fibonacci(i));
}
print("\n");
return 0;
}
--// Generated by roblox-c v1.0.0 \\--
--Note: This code will not be very clean.
local C = require(game.ReplicatedStorage:WaitForChild("Packages").cruntime)
function fibonacci(n)
if (n<=1) then
return n
else
return (fibonacci(n-1)+fibonacci(n-2))
end
end
do
local n = 10
local i = 0
while (i<n) do
i += 1
print(C.cast("char *", fibonacci(i)))
end
print("\n")
return 0
end
Types do not get compiled because typechecking happens by gcc on roblox-c compile time.
//#include <iostream>
#include "rbx.h"
//using namespace std;
int main() {
int SECRET_NUMBER = 1;
if (true) {
//cout << "Hello, World!" << endl;
print("Hello, World!");
}
switch (SECRET_NUMBER) {
case 1:
//cout << "You got it correct with the number 1!" << endl;
print("You got it correct with the number 1!");
break;
default:
//cout << "Oop, secret number isn't 1!" << endl;
print("Oop, secret number isn't 1!");
break;
}
return 0;
}
When trying to compile, I get this error:
So, I removed the bool literal, now having this:
//#include <iostream>
#include "rbx.h"
//using namespace std;
int main() {
int SECRET_NUMBER = 1;
// if (true) {
// //cout << "Hello, World!" << endl;
// print("Hello, World!");
// }
switch (SECRET_NUMBER) {
case 1:
//cout << "You got it correct with the number 1!" << endl;
print("You got it correct with the number 1!");
break;
default:
//cout << "Oop, secret number isn't 1!" << endl;
print("Oop, secret number isn't 1!");
break;
}
return 0;
}
And then I get this:
--// Generated by roblox-c v1.0.0 \\--
--Note: This code will not be very clean.
local C = require(game.ReplicatedStorage:WaitForChild("Packages").cruntime)
do
local SECRET_NUMBER = 1
C.switch(SECRET_NUMBER, {
[1] = function()print("You got it correct with the number 1!")
end,
break
[C.def] = function()print("Oop, secret number isn't 1!")
end,
break
})
return 0
end
Whichā¦ doesnāt work. In order to get this functionality, I have to remove break.
Thanks for reporting this, Bools arent supported because C++ interprets them as 0 and 1s so I forgot to add it. I will try to improve performance with breaks. Indenting the break the same as the other items should fix it.
This is awesome! I really wanted to use Python when coding in Roblox (this is also a good way if u wanna learn a new Language), im tired of Luau sometimes, but also this gives advantages for people who dont know Lua but want to code on Roblox.