func runUnsafeLua(vm *lua.State, unsafe string) error { start := time.Now() defer func() { duration := time.Since(start) if err := recover(); err != nil { if err == halt { fmt.Println("Some code took too long! Stopping after: ", duration) } panic(err) } }() vm.SetExecutionLimit(maxExecutionTime * (1 << 26)) err := vm.DoString(unsafe) if err.Error() == "Lua execution quantum exceeded" { panic(halt) } return err }