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

Function findField

auxiliary.go:142–161  ·  view source on GitHub ↗
(l *State, objectIndex, level int)

Source from the content-addressed store, hash-verified

140}
141
142func findField(l *State, objectIndex, level int) bool {
143 if level == 0 || !l.IsTable(-1) {
144 return false
145 }
146 for l.PushNil(); l.Next(-2); l.Pop(1) { // for each pair in table
147 if l.IsString(-2) { // ignore non-string keys
148 if l.RawEqual(objectIndex, -1) { // found object?
149 l.Pop(1) // remove value (but keep name)
150 return true
151 } else if findField(l, objectIndex, level-1) { // try recursively
152 l.Remove(-2) // remove table (but keep name)
153 l.PushString(".")
154 l.Insert(-2) // place "." between the two names
155 l.Concat(3)
156 return true
157 }
158 }
159 }
160 return false
161}
162
163func pushGlobalFunctionName(l *State, f Frame) bool {
164 top := l.Top()

Callers 1

pushGlobalFunctionNameFunction · 0.85

Calls 10

IsTableMethod · 0.80
PushNilMethod · 0.80
NextMethod · 0.80
PopMethod · 0.80
IsStringMethod · 0.80
RawEqualMethod · 0.80
RemoveMethod · 0.80
PushStringMethod · 0.80
InsertMethod · 0.80
ConcatMethod · 0.80

Tested by

no test coverage detected