MCPcopy Create free account
hub / github.com/yuin/gopher-lua / Insert

Method Insert

_state.go:1352–1367  ·  view source on GitHub ↗
(value LValue, index int)

Source from the content-addressed store, hash-verified

1350}
1351
1352func (ls *LState) Insert(value LValue, index int) {
1353 reg := ls.indexToReg(index)
1354 top := ls.reg.Top()
1355 if reg >= top {
1356 ls.reg.Set(reg, value)
1357 return
1358 }
1359 if reg <= ls.currentLocalBase() {
1360 reg = ls.currentLocalBase()
1361 }
1362 top--
1363 for ; top >= reg; top-- {
1364 ls.reg.Set(top+1, ls.reg.Get(top))
1365 }
1366 ls.reg.Set(reg, value)
1367}
1368
1369func (ls *LState) Remove(index int) {
1370 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