func map__index(L *lua.State) int {
	v, t := valueOfProxy(L, 1)
	key := reflect.New(t.Key())
	err := LuaToGo(L, 2, key.Interface())
	if err == nil {
		key = key.Elem()
		val := v.MapIndex(key)
		if val.IsValid() {
			GoToLuaProxy(L, val)
			return 1
		}
	}
	if !L.IsNumber(2) && L.IsString(2) {
		name := L.ToString(2)
		pushGoMethod(L, name, v)
		return 1
	}
	if err != nil {
		L.RaiseError(fmt.Sprintf("map requires %v key", t.Key()))
	}
	return 0
}
func map__index(L *lua.State) int {
	v, t := valueOfProxy(L, 1)
	key := reflect.New(t.Key())
	err := LuaToGo(L, 2, key.Interface())
	if err == nil {
		key = key.Elem()
		val := v.MapIndex(key)
		if val.IsValid() {
			GoToLuaProxy(L, val)
			return 1
		}
	}
	if !L.IsNumber(2) && L.IsString(2) {
		name := L.ToString(2)
		pushGoMethod(L, name, v)
		return 1
	}
	if err != nil {
		L.RaiseError(fmt.Sprintf("map requires %v key", t.Key()))
	}
	return 0
}
func map__index ( L * lua . State ) int { v , t := valueOfProxy ( L , 1 ) key := reflect . New ( t . Key ( ) ) err := LuaToGo ( L , 2 , key . Interface ( ) ) if err == nil { key = key . Elem ( ) val := v . MapIndex ( key ) if val . IsValid ( ) { GoToLuaProxy ( L , val ) return 1 } } if ! L . IsNumber ( 2 ) && L . IsString ( 2 ) { name := L . ToString ( 2 ) pushGoMethod ( L , name , v ) return 1 } if err != nil { L . RaiseError ( fmt . Sprintf ( " " , t . Key ( ) ) ) } return 0 }
// TODO: Should map[string] and struct allow direct method calls? Check if first letter is uppercase?
TODO : Should map [ string ] and struct allow direct method calls? Check if first letter is uppercase?