melt/Sync/Server/compile.go

22 lines
354 B
Go

package main
import (
"os"
"os/exec"
)
func CompileLuau(sourcePath string) (string, error) {
path, err := exec.LookPath("./tools/darklua")
if err != nil {
return "", err
}
cmd := exec.Command(path, "process", sourcePath, "./temp.lua")
cmd.Run()
// Return the compiled file
file, _ := os.ReadFile("./temp.lua")
return string(file), nil
}