luaobject.go
func (lo *LuaObject) Setv(src *LuaObject, keys ...string) error {
	// TODO: Rename? This function seems to be too specialized, is it worth
	// keeping at all?
	L := lo.l
	if L != src.l {
		return ErrLuaObjectUnsharedState
	}
	lo.Push()
	defer L.Pop(1)
	loIdx := L.GetTop()

	var set func(int, string)
	if L.IsTable(loIdx) {
		set = L.SetField
	} else if L.GetMetaField(loIdx, "__newindex") {
		L.Pop(1)
		set = func(idx int, key string) {
			resultIdx := L.GetTop()
			L.GetMetaField(loIdx, "__newindex")
			L.PushValue(loIdx)
			L.PushString(key)
			L.PushValue(resultIdx)
			L.Remove(resultIdx)
			L.Call(3, 0)
		}
	} else {
		return ErrLuaObjectIndexable
	}

	src.Push()
	defer src.l.Pop(1)
	srcIdx := L.GetTop()
	var get func(int, string)
	if L.IsTable(srcIdx) {
		get = L.GetField
	} else if L.GetMetaField(srcIdx, "__index") {
		L.Pop(1)
		get = func(idx int, key string) {
			L.GetMetaField(srcIdx, "__index")
			L.PushValue(srcIdx)
			L.PushString(key)
			L.Call(2, 1)
		}
	} else {
		return ErrLuaObjectIndexable
	}

	for _, key := range keys {
		get(srcIdx, key)
		set(loIdx, key)
	}

	return nil
}
func (lo *LuaObject) Setv(src *LuaObject, keys ...string) error {
	// TODO: Rename? This function seems to be too specialized, is it worth
	// keeping at all?
	L := lo.l
	if L != src.l {
		return ErrLuaObjectUnsharedState
	}
	lo.Push()
	defer L.Pop(1)
	loIdx := L.GetTop()

	var set func(int, string)
	if L.IsTable(loIdx) {
		set = L.SetField
	} else if L.GetMetaField(loIdx, "__newindex") {
		L.Pop(1)
		set = func(idx int, key string) {
			resultIdx := L.GetTop()
			L.GetMetaField(loIdx, "__newindex")
			L.PushValue(loIdx)
			L.PushString(key)
			L.PushValue(resultIdx)
			L.Remove(resultIdx)
			L.Call(3, 0)
		}
	} else {
		return ErrLuaObjectIndexable
	}

	src.Push()
	defer src.l.Pop(1)
	srcIdx := L.GetTop()
	var get func(int, string)
	if L.IsTable(srcIdx) {
		get = L.GetField
	} else if L.GetMetaField(srcIdx, "__index") {
		L.Pop(1)
		get = func(idx int, key string) {
			L.GetMetaField(srcIdx, "__index")
			L.PushValue(srcIdx)
			L.PushString(key)
			L.Call(2, 1)
		}
	} else {
		return ErrLuaObjectIndexable
	}

	for _, key := range keys {
		get(srcIdx, key)
		set(loIdx, key)
	}

	return nil
}
// Setv copies values between two tables in the same Lua state.
// It overwrites existing values.