This project was inspired by vLua but now supports luau types and uses LuauCeption compiler and Fiu VM. LuauVM.rbxm (687.3 KB)
You are able to use all luau features (+=, -=… and types).
Example usage:
local LuauVM = require(path.to.LuauVM)
--Compile a string
print(LuauVM.compile([[
local a = "hi2" :: string
print(a)]]))
--Pure string
LuauVM([[
local a = "hi1" :: string
print(a)
]])()
--Precompiled bytecode.
LuauVM([[BgMCBXByaW50A2hpMgABAgAAAQIABkEAAAAMAAEAAAAAQAUBAgAVAAIBFgABAAMDAQQAAABAAwIAAQABGAABAAAAAAEAAAAAAA==]], true)()
Does it compile an actual Luau bytecode?
I’m just thinking about writing a preprocessor (compiler, really) to optimize Luau code (mostly inlining).
If so, that would be a really great resource.
Have you written the compiler yourself or taken code from somewhere?
Yeah Luau is always compiled(unlike python). Not into cpu instructions, but into bytecode for interpreter to execute. As i said compiler was taken from LuauCeption github:
Edit:
Yes it compiles actual luau bytecode.
Edit 2:
Its improtant to note that LuauCeption takes actual luau compiler and converts it to luau using Rerumu’s Spider.
This needs to be boosted more, genuinely works better then most Luau VMs around at the minute, especially with the new getfenv() changes with sandboxing