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

Method findLocal

_state.go:654–673  ·  view source on GitHub ↗
(frame *callFrame, no int)

Source from the content-addressed store, hash-verified

652}
653
654func (ls *LState) findLocal(frame *callFrame, no int) string {
655 fn := frame.Fn
656 if !fn.IsG {
657 if name, ok := fn.LocalName(no, frame.Pc-1); ok {
658 return name
659 }
660 }
661 var top int
662 if ls.currentFrame == frame {
663 top = ls.reg.Top()
664 } else if frame.Idx+1 < ls.stack.Sp() {
665 top = ls.stack.At(frame.Idx + 1).Base
666 } else {
667 return ""
668 }
669 if top-frame.LocalBase >= no {
670 return "(*temporary)"
671 }
672 return ""
673}
674
675func (ls *LState) where(level int, skipg bool) string {
676 dbg, ok := ls.GetStack(level)

Callers 2

GetLocalMethod · 0.95
SetLocalMethod · 0.95

Calls 4

LocalNameMethod · 0.80
SpMethod · 0.65
AtMethod · 0.65
TopMethod · 0.45

Tested by

no test coverage detected