You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lua.go
    path of file: ./repos/rueidis
    
    the code of the file until where you have to start completion: package rueidis

import (
	"context"
	"crypto/sha1"
	"encoding/hex"
	"runtime"
	"sync/atomic"

	"github.com/redis/rueidis/internal/util"
)

// NewLuaScript creates a Lua instance whose Lua.Exec uses EVALSHA and EVAL.
func NewLuaScript(script string) *Lua {
	sum := sha1.Sum([]byte(script))
	return &Lua{script: script, sha1: hex.EncodeToSt
    
func (s *Lua) Exec(ctx context.Context, c Client, keys, args []string) (resp RedisResult) {
	if s.readonly {
		resp = c.Do(ctx, c.B().EvalshaRo().Sha1(s.sha1).Numkeys(int64(len(keys))).Key(keys...).Arg(args...).Build())
	} else {
		resp = c.Do(ctx, c.B().Evalsha().Sha1(s.sha1).Numkeys(int64(len(keys))).Key(keys...).Arg(args...).Build())
	}
	if err, ok := IsRedisErr(resp.Error()); ok && err.IsNoScript() {
		if s.readonly {
			resp = c.Do(ctx, c.B().EvalRo().Script(s.script).Numkeys(int64(len(keys))).Key(keys...).Arg(args...).Build())
		} else {
			resp = c.Do(ctx, c.B().Eval().Script(s.script).Numkeys(int64(len(keys))).Key(keys...).Arg(args...).Build())
		}
	}
	return resp
}