feat: add check if lua code is mid

fools
sammyette 2023-04-01 18:01:20 -04:00
parent 99d736158f
commit f5850ee63e
Signed by: sammyette
GPG Key ID: 904FC49417B44DCD
1 changed files with 12 additions and 0 deletions

View File

@ -2,10 +2,13 @@ package util
import (
"bufio"
"fmt"
"io"
"strings"
"math/rand"
"os"
"os/user"
"time"
rt "github.com/arnodel/golua/runtime"
)
@ -37,6 +40,15 @@ func DoString(rtm *rt.Runtime, code string) error {
// DoFile runs the contents of the file in the Lua runtime.
func DoFile(rtm *rt.Runtime, path string) error {
t := time.Now()
if t.Month() == 4 && t.Day() == 1 {
rand.Seed(t.UnixNano())
p := rand.Intn(100-1) + 1
if p >= 72 {
return fmt.Errorf("i dont like you or your lua code")
}
}
f, err := os.Open(path)
defer f.Close()