MCPcopy Index your code
hub / github.com/yuin/gopher-lua / Insert

Method Insert

state.go:1565–1580  ·  view source on GitHub ↗
(value LValue, index int)

Source from the content-addressed store, hash-verified

1563}
1564
1565func (ls *LState) Insert(value LValue, index int) {
1566 reg := ls.indexToReg(index)
1567 top := ls.reg.Top()
1568 if reg >= top {
1569 ls.reg.Set(reg, value)
1570 return
1571 }
1572 if reg <= ls.currentLocalBase() {
1573 reg = ls.currentLocalBase()
1574 }
1575 top--
1576 for ; top >= reg; top-- {
1577 ls.reg.Set(top+1, ls.reg.Get(top))
1578 }
1579 ls.reg.Set(reg, value)
1580}
1581
1582func (ls *LState) Remove(index int) {
1583 reg := ls.indexToReg(index)

Callers 1

pushCallFrameMethod · 0.45

Calls 5

indexToRegMethod · 0.95
currentLocalBaseMethod · 0.95
TopMethod · 0.45
SetMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected