MCPcopy Index your code
hub / github.com/Shopify/go-lua / setIndexToValue

Method setIndexToValue

lua.go:518–535  ·  view source on GitHub ↗
(index int, v value)

Source from the content-addressed store, hash-verified

516}
517
518func (l *State) setIndexToValue(index int, v value) {
519 switch {
520 case index > 0:
521 l.stack[l.callInfo.function:l.top][index] = v
522 // if i := callInfo.function + index; i < l.top {
523 // l.stack[i] = v
524 // } else {
525 // panic("unacceptable index")
526 // }
527 case index > RegistryIndex: // negative index
528 l.stack[l.top+index] = v
529 case index == RegistryIndex:
530 l.global.registry = v.(*table)
531 default: // upvalues
532 i := RegistryIndex - index
533 l.stack[l.callInfo.function].(*goClosure).upValues[i-1] = v
534 }
535}
536
537// AbsIndex converts the acceptable index index to an absolute index (that
538// is, one that does not depend on the stack top).

Callers 2

moveMethod · 0.95
ToStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected