func baseDoFile(state *lua.State) int {
	var (
		file             = state.OptString(1, "")
		src  interface{} = nil
	)
	state.SetTop(1)
	if file == "" {
		file = "stdin"
		src = os.Stdin
	}
	if err := state.LoadChunk(file, src, 0); err != nil {
		panic(err)
	}
	state.Call(0, lua.MultRets)
	return state.Top() - 1
}
dofile([filename])

Opens the named file and executes its contents as a Lua chunk.
When called without arguments, dofile executes the contents of
the standard input (stdin). Returns all values returned by the
chunk. In case of errors, dofile propagates the error to its
caller (that is, dofile does not run in protected mode).

See https://www.lua.org/manual/5.3/manual.html#pdf-dofile
package base
import (
	"fmt"
	"os"
	"runtime"
	"strconv"
	"strings"
	"github.com/Azure/golua/lua"
)
func Open(state *lua.State) int {
	var baseFuncs = map[string]lua.Func{
		"assert":         lua.Func(baseAssert),
		"dofile":         lua.Func(baseDoFile),
		"error":          lua.Func(baseError),
		"getmetatable":   lua.Func(baseGetMetaTable),
		"ipairs":         lua.Func(baseIPairs),
		"loadfile":       lua.Func(baseLoadFile),
		"load":           lua.Func(baseLoad),
		"next":           lua.Func(baseNext),
		"pairs":          lua.Func(basePairs),
		"pcall":          lua.Func(basePCall),
		"print":          lua.Func(basePrint),
		"rawequal":       lua.Func(baseRawEqual),
		"rawlen":         lua.Func(baseRawLen),
		"rawget":         lua.Func(baseRawGet),
		"rawset":         lua.Func(baseRawSet),
		"select":         lua.Func(baseSelect),
		"setmetatable":   lua.Func(baseSetMetaTable),
		"tonumber":       lua.Func(baseToNumber),
		"tostring":       lua.Func(baseToString),
		"type":           lua.Func(baseType),
		"xpcall":         lua.Func(baseXpcall),
		"collectgarbage": lua.Func(baseGC),
	}
	state.PushGlobals()
	state.SetFuncs(baseFuncs, 0)
	state.PushIndex(-1)
	state.SetField(-2, "_G")
	state.Push(lua.Version)
	state.SetField(-2, "_VERSION")
	return 1
}
func baseAssert(state *lua.State) int {
	if state.ToBool(1) {
		return state.Top()
	}
	state.CheckAny(1)
	state.Remove(1)
	state.Push("assert failed!")
	state.SetTop(1)
	return baseError(state)
}