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

Method Push

state.go:286–302  ·  view source on GitHub ↗

Push pushes the passed callFrame onto the stack. it panics if the stack is full, caller should call IsFull() before invoking this to avoid this.

(v callFrame)

Source from the content-addressed store, hash-verified

284// Push pushes the passed callFrame onto the stack. it panics if the stack is full, caller should call IsFull() before
285// invoking this to avoid this.
286func (cs *autoGrowingCallFrameStack) Push(v callFrame) {
287 curSeg := cs.segments[cs.segIdx]
288 if cs.segSp >= FramesPerSegment {
289 // segment full, push new segment if allowed
290 if cs.segIdx < segIdx(len(cs.segments)-1) {
291 curSeg = newCallFrameStackSegment()
292 cs.segIdx++
293 cs.segments[cs.segIdx] = curSeg
294 cs.segSp = 0
295 } else {
296 panic("lua callstack overflow")
297 }
298 }
299 curSeg.array[cs.segSp] = v
300 curSeg.array[cs.segSp].Idx = int(cs.segSp) + FramesPerSegment*int(cs.segIdx)
301 cs.segSp++
302}
303
304// Sp retrieves the current stack depth, which is the number of frames currently pushed on the stack.
305func (cs *autoGrowingCallFrameStack) Sp() int {

Callers

nothing calls this directly

Calls 2

segIdxTypeAlias · 0.70
newCallFrameStackSegmentFunction · 0.70

Tested by

no test coverage detected