mirror of https://github.com/Hilbis/Hilbish
feat: add check if lua code is mid
parent
99d736158f
commit
f5850ee63e
12
util/util.go
12
util/util.go
|
@ -2,10 +2,13 @@ package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"time"
|
||||||
|
|
||||||
rt "github.com/arnodel/golua/runtime"
|
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.
|
// DoFile runs the contents of the file in the Lua runtime.
|
||||||
func DoFile(rtm *rt.Runtime, path string) error {
|
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)
|
f, err := os.Open(path)
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue