func NewPluginState() *lua.LState {
	state := lua.NewState()
	filepath.Preload(state)
	http.Preload(state)
	inspect.Preload(state)
	ioutil.Preload(state)
	json.Preload(state)
	regexp.Preload(state)
	strings.Preload(state)
	tac.Preload(state)
	tcp.Preload(state)
	time.Preload(state)
	xmlpath.Preload(state)
	yaml.Preload(state)
	zabbix.Preload(state)
	telegram.Preload(state)
	storage.Preload(state)
	crypto.Preload(state)
	goos.Preload(state)
	humanize.Preload(state)
	db.Preload(state)
	chef.Preload(state)
	cmd.Preload(state)
	template.Preload(state)
	cloudwatch.Preload(state)
	log.Preload(state)
	prometheus.Preload(state)
	pb.Preload(state)
	stats.Preload(state)
	return state
}
NewPluginState return lua state
package plugin
import (
	"context"
	"sync"
	"github.com/vadv/gopher-lua-libs/stats"
	cloudwatch "github.com/vadv/gopher-lua-libs/aws/cloudwatch"
	chef "github.com/vadv/gopher-lua-libs/chef"
	cmd "github.com/vadv/gopher-lua-libs/cmd"
	crypto "github.com/vadv/gopher-lua-libs/crypto"
	db "github.com/vadv/gopher-lua-libs/db"
	filepath "github.com/vadv/gopher-lua-libs/filepath"
	goos "github.com/vadv/gopher-lua-libs/goos"
	http "github.com/vadv/gopher-lua-libs/http"
	humanize "github.com/vadv/gopher-lua-libs/humanize"
	inspect "github.com/vadv/gopher-lua-libs/inspect"
	ioutil "github.com/vadv/gopher-lua-libs/ioutil"
	json "github.com/vadv/gopher-lua-libs/json"
	log "github.com/vadv/gopher-lua-libs/log"
	pb "github.com/vadv/gopher-lua-libs/pb"
	prometheus "github.com/vadv/gopher-lua-libs/prometheus/client"
	regexp "github.com/vadv/gopher-lua-libs/regexp"
	storage "github.com/vadv/gopher-lua-libs/storage"
	strings "github.com/vadv/gopher-lua-libs/strings"
	tac "github.com/vadv/gopher-lua-libs/tac"
	tcp "github.com/vadv/gopher-lua-libs/tcp"
	telegram "github.com/vadv/gopher-lua-libs/telegram"
	template "github.com/vadv/gopher-lua-libs/template"
	time "github.com/vadv/gopher-lua-libs/time"
	xmlpath "github.com/vadv/gopher-lua-libs/xmlpath"
	yaml "github.com/vadv/gopher-lua-libs/yaml"
	zabbix "github.com/vadv/gopher-lua-libs/zabbix"
	lua "github.com/yuin/gopher-lua"
)
type luaPlugin struct {
	sync.Mutex
	state      *lua.LState
	cancelFunc context.CancelFunc
	running    bool
	error      error
	body       *string
	filename   *string
	jobPayload *string
}
func (p *luaPlugin) getError() error {
	p.Lock()
	defer p.Unlock()
	err := p.error
	return err
}
func (p *luaPlugin) getRunning() bool {
	p.Lock()
	defer p.Unlock()
	running := p.running
	return running
}
func (p *luaPlugin) setError(err error) {
	p.Lock()
	defer p.Unlock()
	p.error = err
}
func (p *luaPlugin) setRunning(val bool) {
	p.Lock()
	defer p.Unlock()
	p.running = val
}