How does the :s command in Adonis work?

Sounds interesting. A lot of fun but I don’t really understand about 90% of that sort of stuff. :stuck_out_tongue:

So does this mean you can create a program to execute javascript in a script or something? That would be really cool. Of course the js code would be a multi-line string in a script which is parsed through the VM.

Just an idea/query.

It’s possible.
Back in my earlier fun days I made a couple assembly-like languages for fun and to start understanding how parsing and interpreting worked. You can do it with just about any language you can imagine, although it does take some time to get working.

Has someone already made an interpreter for other languages on this site, to your knowledge?

Apparently @einsteinK has, or so he has told me. Besides that, I don’t know of any others. It’s not an often explored part of Lua on here.

1 Like

I tried to port the Fantom language to Roblox Lua at one point. I got much further than the Model suggests, I actually had a partially working code generator that output to Lua Bytecode, which is one of the things that I made the LASM assembler for in the first place. I gave up on that after Roblox removed the ability to loadstring binary chunks.

Side note, Fantom is one of my favorite obscure programming languages. Its serialized-constructor syntax is actually where I got the idea for the the create"ClassName"{member = value} construct I introduced on Roblox.

2 Likes

There’s a lot of fun to be had in this area, but it often doesn’t serve much of a purpose on Roblox (unless you’re going for maximum code obfuscation). Nonetheless, I’ve been working on a C-like port, but with how lazy I am to work on things it’ll probably take a while.

1 Like

I’ve done some things like parsing respawn and teleport reru and strav to me which would respawn Rerumu/Stravant and teleport them to me. Not really a programming language, but still parser-related, so eh.

I was working on “porting” Java to roblox. I posted about it in the 2016 “what are you working on” thread:
What are you working on currently? [2016] - #2715 by einsteinK
What are you working on currently? [2016] - #2727 by einsteinK

Never finished it, but it could run this code:

package testing;

native NativeTest {
	print("hi",...)
}

public class Banana {
	private static String testString = "hi";
	private static a.b.c.Test idk = new a.b.c.Test(testString);
	public static Banana test;
	private static Banana test2;
	public Banana(){}
	private static void APPLE(){
		Integer a = 1;
		print("a:",a);
		int b = 2;
		a += 5;
		test2 = new Banana();
		NativeTest(a,b+a,test2.toString());
	}
}
local res = Compiler.compile(ABOVE_CODE)
local VM = require(script:WaitForChild("VM"))
local class,thread = VM:LoadClass(res,res.classes["testing.Banana"])
local res = VM:InvokeStaticWithoutArguments(class,"APPLE",thread)
if res.success then
	print("Result:",res.result)
else
	print("Error:",res.information)
end
--[[
Error: Workspace.Lurova.VM:591: Can't cast this primitive to lurova.util.String
--> NativeTest(a,b+a,test2.toString());
Stack begin
Method 'testing.Banana.APPLE()', Line 19
Stack end
--]]

I forgot what I was last working on, so I’m not sure why it errors, but similar pieces of code work fine. I had a class registry, a compiler that converts to a table format (some kind of self-made AST) and of course a VM that could execute the table format.

As you can tell, I also added some “native” stuff, which basically allowed embedding (real) Lua functions, which would obviously be faster than running stuff in the VM. I’m pretty sure I also allowed something like native String NativeTest(String a) {}, but too long ago to be sure. EDIT: Took a quick glance at the source code, as I wasn’t entirely sure, but it seems like native (static) class methods were also supported, so very fun.

one of my many projects I started and are now… “suspended”

1 Like

Looks very interesting!

@Sceleratis @Rerumu Does the loadstring module work to allow a local environment for ls commands? If so, how does one enable that? <3

The last few lines in the source contains the function that handles actual wrapping; it takes 2 arguments: the bytecode, and the table used for the environment in which it’ll run.

1 Like