Exemple #1
0
func txFetchArrayElement(st *State) {
	// There should only be items pushed
	array := reflect.ValueOf(st.StackPop())
	idx := st.StackPop()

	v := array.Index(int(idx.(int64)))
	st.sa = v.Interface()
	st.Advance()
}
Exemple #2
0
func txFetchArrayElement(st *State) {
	defer st.Advance()

	array := reflect.ValueOf(st.StackPop())
	switch array.Kind() {
	case reflect.Array, reflect.Slice:
	default:
		st.Warnf("cannot index into non-array/slice element")
		return
	}

	idx := st.StackPop()
	v := array.Index(int(idx.(int64)))
	st.sa = v.Interface()
}