func CallMeta(l *State, index int, event string) bool {
	index = l.AbsIndex(index)
	if !MetaField(l, index, event) {
		return false
	}
	l.PushValue(index)
	l.Call(1, 1)
	return true
}
CallMeta calls a metamethod.

If the object at index has a metatable and this metatable has a field event,
this function calls this field passing the object as its only argument. In
this case this function returns true and pushes onto the stack the value
returned by the call. If there is no metatable or no metamethod, this
function returns false (without pushing any value on the stack).
package lua
import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)
func functionName(l *State, d Debug) string {
	switch {
	case d.NameKind != "":
		return fmt.Sprintf("function '%s'", d.Name)
	case d.What == "main":
		return "main chunk"
	case d.What == "Go":
		if pushGlobalFunctionName(l, d.callInfo) {
			s, _ := l.ToString(-1)
			l.Pop(1)
			return fmt.Sprintf("function '%s'", s)
		} else {
			return "?"
		}
	}
	return fmt.Sprintf("function <%s:%d>", d.ShortSource, d.LineDefined)
}
func countLevels(l *State) int {
	li, le := 1, 1
	for _, ok := Stack(l, le); ok; _, ok = Stack(l, le) {
		li = le
		le *= 2
	}
	for li < le {
		m := (li + le) / 2
		if _, ok := Stack(l, m); ok {
			li = m + 1
		} else {
			le = m
		}
	}
	return le - 1
}
func Traceback(l, l1 *State, message string, level int) {
	const levels1, levels2 = 12, 10
	levels := countLevels(l1)
	mark := 0
	if levels > levels1+levels2 {
		mark = levels1
	}
	buf := message
	if buf != "" {
		buf += "\n"
	}
	buf += "stack traceback:"
	for f, ok := Stack(l1, level); ok; f, ok = Stack(l1, level) {
		if level++; level == mark {
			buf += "\n\t..."
			level = levels - levels2
		} else {
			d, _ := Info(l1, "Slnt", f)
			buf += "\n\t" + d.ShortSource + ":"
			if d.CurrentLine > 0 {
				buf += fmt.Sprintf("%d:", d.CurrentLine)
			}
			buf += " in " + functionName(l, d)
			if d.IsTailCall {
				buf += "\n\t(...tail calls...)"
			}
		}
	}
	l.PushString(buf)
}
func MetaField(l *State, index int, event string) bool {
	if !l.MetaTable(index) {
		return false
	}
	l.PushString(event)
	l.RawGet(-2)
	if l.IsNil(-1) {
		l.Pop(2)  
		return false
	}
	l.Remove(-2)  
	return true
}