<commit_before>package lua

import (
	"errors"
	"fmt"
	"os"
	"reflect"
	"sync"
	"syscall"
	"unsafe"
)

const trace = false

var luaDLL = syscall.NewLazyDLL("lua53.dll")

type Integer int64

func (value Integer) Push(L Lua) int {
	if trace {
		fmt.Fprintf(os.Stderr, "lua.Integer(%v).Push()\n", value)
	}
	L.PushInteger(value)
	return 1
}

type Lua uintptr

type packageIdT struct{}

var PackageId packageIdT

var userdataAnchor = make(map[Lua]map[uintptr]interface{})
var userdateAnchorMutex = sync.RWMutex{}

var luaL_newstate = luaDLL.NewProc("luaL_newstate")

func New() (Lua, error) {
	if err := luaL_newstate.Find(); err != nil {
		return Lua(0), err
	}
	lua, _, _ := luaL_newstate.Call()
	if trace {
		fmt.Fprintf(os.Stderr, "lua.New()=%v\n", lua)
	}
	userdateAnchorMutex.Lock()
	userdataAnchor[Lua(lua)] = make(map[uintptr]interface{})
	userdateAnchorMutex.Unlock()
	return Lua(lua), nil
}

func (this Lua) State() uintptr {
	return uintptr(this)
}

var luaL_openlibs = luaDLL.NewProc("luaL_openlibs")

func (this Lua) OpenLibs() {
	if trace {
		fmt.Fprintf(os.Stderr, "Lua(%v).OpenLibs()\n", this)
	}
	luaL_openlibs.Call(this.State())
}

var lua_close = luaDLL.NewProc("lua_close")

func (this Lua) Close() error {
	if trace {
		fmt.Fprintf(os.Stderr, "Lua(%v).Close()\n", this)
	}
	lua_close.Call(this.State())
	userdateAnchorMutex.Lock()
	delete(userdataAnchor, this)
	userdateAnchorMutex.Unlock()
	return nil
}

func (this Lua) Source(fname string) error {
	if trace {
		fmt.Fprintf(os.Stderr, "Lua(%v).Source(%v)\n", this, fname)
	}
	if _, err := this.LoadFile(fname, "bt"); err != nil {
		return err
	}
	return this.Call(0, 0)
}

var lua_settable = luaDLL.NewProc("lua_settable")

// t[k] = v , t: given index, k: top of stack , v: value just below the top (pop 2 and push 0 element)<commit_msg>Remove unused function: lua.Source<commit_after>package lua

import (
	"errors"
	"fmt"
	"os"
	"reflect"
	"sync"
	"syscall"
	"unsafe"
)

const trace = false

var luaDLL = syscall.NewLazyDLL("lua53.dll")

type Integer int64

func (value Integer) Push(L Lua) int {
	if trace {
		fmt.Fprintf(os.Stderr, "lua.Integer(%v).Push()\n", value)
	}
	L.PushInteger(value)
	return 1
}

type Lua uintptr

type packageIdT struct{}

var PackageId packageIdT

var userdataAnchor = make(map[Lua]map[uintptr]interface{})
var userdateAnchorMutex = sync.RWMutex{}

var luaL_newstate = luaDLL.NewProc("luaL_newstate")

func New() (Lua, error) {
	if err := luaL_newstate.Find(); err != nil {
		return Lua(0), err
	}
	lua, _, _ := luaL_newstate.Call()
	if trace {
		fmt.Fprintf(os.Stderr, "lua.New()=%v\n", lua)
	}
	userdateAnchorMutex.Lock()
	userdataAnchor[Lua(lua)] = make(map[uintptr]interface{})
	userdateAnchorMutex.Unlock()
	return Lua(lua), nil
}

func (this Lua) State() uintptr {
	return uintptr(this)
}

var luaL_openlibs = luaDLL.NewProc("luaL_openlibs")

func (this Lua) OpenLibs() {
	if trace {
		fmt.Fprintf(os.Stderr, "Lua(%v).OpenLibs()\n", this)
	}
	luaL_openlibs.Call(this.State())
}

var lua_close = luaDLL.NewProc("lua_close")

func (this Lua) Close() error {
	if trace {
		fmt.Fprintf(os.Stderr, "Lua(%v).Close()\n", this)
	}
	lua_close.Call(this.State())
	userdateAnchorMutex.Lock()
	delete(userdataAnchor, this)
	userdateAnchorMutex.Unlock()
	return nil
}

var lua_settable = luaDLL.NewProc("lua_settable")

// t[k] = v , t: given index, k: top of stack , v: value just below the top (pop 2 and push 0 element)
{'fraction_non_alphanumeric': 0.1559847819724905, 'fraction_numerical': 0.0052677787532923615, 'mean_word_length': 4.649586776859504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4455327', 'n_tokens_mistral': 1445, 'n_tokens_neox': 1369, 'n_words': 307}